static const struct regmap_config chtdc_ti_regmap_config = { .reg_bits = 8, .val_bits = 8, .max_register = 0xff, + /* The hardware does not support reading multiple registers at once */ + .use_single_read = true, }; static const struct regmap_irq chtdc_ti_irqs[] = { -- 2.51.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id iLYdCNCY7WjnPjwAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 00:26:56 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 00:26:56 +0000 Received: from ams.mirrors.kernel.org ([213.196.21.55]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8SsR-0000000HCfv-3Rwn for hi@josie.lol; Tue, 14 Oct 2025 00:26:56 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.mirrors.kernel.org (Postfix) with ESMTPS id 9AFFE34FCD8 for ; Tue, 14 Oct 2025 00:26:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9CA0C2C0F60; Tue, 14 Oct 2025 00:17:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jlZe7dza" X-Original-To: stable@vger.kernel.org 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 76A702BF3CF for ; Tue, 14 Oct 2025 00:17:38 +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=1760401058; cv=none; b=pXJAQCnFfICUroOtZw/i3A05L8PWte3XBMzSk3kzL9yDitbuLZcXUBOa9Q5pzA13+jyzw5xvHeoVpin71H10EL64cJkpYmrUaG1R1dp/IdpDQELoKH7aWMXAgy/M4RZxiP5J2GuvTD2mi7+TtzjctXouDT/VGTl2O0A9zzlVkwk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760401058; c=relaxed/simple; bh=ixWSgdv0V8B1x5iuEtwIBYT1UuRENhdJ1SbbYJc8Onw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ikYpAhGodgZ4Nj5oyGCyaHLnJWGI9snM1RDS8wgPEL+R5acrzQPCQCCRHqEgHWnAUqyIqlGjYCpzNnVbTj5nbUOktLGThnmFiJanHMMIKl8+rGoLCCYTolDQmg0uo0nsyMNC1I7rRiYbl6Ah76CJEt12Zuk0gM/A0FW+Mpynm2k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jlZe7dza; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C391C116D0; Tue, 14 Oct 2025 00:17:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760401058; bh=ixWSgdv0V8B1x5iuEtwIBYT1UuRENhdJ1SbbYJc8Onw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jlZe7dza3Acj1gpCcFtuV5ffcatgIqYS2c+DjGEqJ+DdXLSAqeDfRJX1MHCTdFdWr RL42QTUXoK21dxYijgK4SYtNuVQxTZKx/Baxpn3fc0pQkSXsKbAgt+T1KgPtvTJJMU w69QWdcEQbcc4woXWYCw7pxr2vmR1Nve0A4nvKDQTZmMbGp9xnCws4jgwXP81ShpsA 5Fn6a3ZaAaCkhWtWc5ygswd7UTJ2+DHib8g93QmowZ6h1F3moaX1bVdBMyM87i8j+P kFsUOkJEXaNoRM2h3st6ppcxhOwoOAnGvzmhZnrXguJWyyk5V9uBRMxvB2ApWPjp+m qiWECnVVS48Sw== From: Sasha Levin To: stable@vger.kernel.org Cc: Andy Shevchenko , Hans de Goede , Lee Jones , Sasha Levin Subject: [PATCH 5.4.y 2/3] mfd: intel_soc_pmic_chtdc_ti: Drop unneeded assignment for cache_type Date: Mon, 13 Oct 2025 20:17:33 -0400 Message-ID: <20251014001734.3748199-2-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251014001734.3748199-1-sashal@kernel.org> References: <2025101316-disarm-pried-7a1f@gregkh> <20251014001734.3748199-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.2 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.2 points) --- pts rule name description ---- ---------------------- ----------------------------------------- -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [213.196.21.55 listed in list.dnswl.org] -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -11 From: Andy Shevchenko [ Upstream commit 9eb99c08508714906db078b5efbe075329a3fb06 ] REGCACHE_NONE is the default type of the cache when not provided. Drop unneeded explicit assignment to it. Note, it's defined to 0, and if ever be redefined, it will break literally a lot of the drivers, so it very unlikely to happen. Signed-off-by: Andy Shevchenko Reviewed-by: Hans de Goede Link: https://lore.kernel.org/r/20250129152823.1802273-1-andriy.shevchenko@linux.intel.com Signed-off-by: Lee Jones Stable-dep-of: 64e0d839c589 ("mfd: intel_soc_pmic_chtdc_ti: Set use_single_read regmap_config flag") Signed-off-by: Sasha Levin --- drivers/mfd/intel_soc_pmic_chtdc_ti.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/mfd/intel_soc_pmic_chtdc_ti.c b/drivers/mfd/intel_soc_pmic_chtdc_ti.c index e787d5655a315..31b30a919348c 100644 --- a/drivers/mfd/intel_soc_pmic_chtdc_ti.c +++ b/drivers/mfd/intel_soc_pmic_chtdc_ti.c @@ -82,7 +82,6 @@ static const struct regmap_config chtdc_ti_regmap_config = { .reg_bits = 8, .val_bits = 8, .max_register = 0xff, - .cache_type = REGCACHE_NONE, }; static const struct regmap_irq chtdc_ti_irqs[] = { -- 2.51.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id kCSQEM2Y7WhxbD4AYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 00:26:53 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 00:26:53 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8SsO-0000000HCdh-47dX for hi@josie.lol; Tue, 14 Oct 2025 00:26:53 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E4DC9405A8C for ; Tue, 14 Oct 2025 00:26:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C0F4C2C0293; Tue, 14 Oct 2025 00:17:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="g0U/r095" X-Original-To: stable@vger.kernel.org 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 9A0E32BF3CF for ; Tue, 14 Oct 2025 00:17:37 +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=1760401057; cv=none; b=BluKYgxsv+5ohvaxZ7URCnxL/9t/DGJgaGI+3tD0+VM1Zs/YUudCnBUCmbZRrl/R7eVxBl3RcSfhd4Onft39c7H4fxMs3C32y62247esDYZ3hQQlB5r/r0TQbhA/mDpKNtuOF4hUDzTeHeIRo/qVPhoyEzaE2YRfQ9e+dd5mE0A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760401057; c=relaxed/simple; bh=N/ZQMFzVhPoV1pD5/tnnXgDoT9Z807F3DJnnElnOYuE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=s6d3Ltl9Lvxt7j++uU5K3FmV1kIAZn0Or3t1SqYTVJqWLgzRSuQQuutTfMsj3tNeGtedmAhnuqeZTLO/K3qGvgKQFW3BTiD0SIVH8EJl3F/JW25WCLCIKOTGIMdwBh5cxwlY6vXIvx6TnGuNmUJLYUveQ5UQbGhaBo2NV9GXhfg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=g0U/r095; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F064C4CEE7; Tue, 14 Oct 2025 00:17:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760401057; bh=N/ZQMFzVhPoV1pD5/tnnXgDoT9Z807F3DJnnElnOYuE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g0U/r0951EaxOqBZzn45TUyPQga8OW/QY4FfKml//Gn7PbwFkZN+052KFaUo1dMce Rpg6kilHayrY2sDMOZ16Me92Df4ShWLFsT7u8cr4lwc+l50TsRop8YcMcppN2yYWGX 6NuE2IH9mU2tcpoHgkRdczJrj0JtAIEZ2l2LapcPwc0vUnX5wNN/tdMsYvstByF9G2 lQfbDWKBZwocUhbcYfy0t34MfOLHQGA09TxHcOpx10RKuBnXZE6Y+TWK1vvxJSBvy/ jFU08qCfwypHJPmhEWk6NcnV0EXUBVd2inac5pk92KvVuirTAJbULoTu2nOvgbvDOS anypxMVzKKiTw== From: Sasha Levin To: stable@vger.kernel.org Cc: Hans de Goede , Andy Shevchenko , Lee Jones , Sasha Levin Subject: [PATCH 5.4.y 1/3] mfd: intel_soc_pmic_chtdc_ti: Fix invalid regmap-config max_register value Date: Mon, 13 Oct 2025 20:17:32 -0400 Message-ID: <20251014001734.3748199-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2025101316-disarm-pried-7a1f@gregkh> References: <2025101316-disarm-pried-7a1f@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.2 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.2 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -11 From: Hans de Goede [ Upstream commit 70e997e0107e5ed85c1a3ef2adfccbe351c29d71 ] The max_register = 128 setting in the regmap config is not valid. The Intel Dollar Cove TI PMIC has an eeprom unlock register at address 0x88 and a number of EEPROM registers at 0xF?. Increase max_register to 0xff so that these registers can be accessed. Signed-off-by: Hans de Goede Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20241208150028.325349-1-hdegoede@redhat.com Signed-off-by: Lee Jones Stable-dep-of: 64e0d839c589 ("mfd: intel_soc_pmic_chtdc_ti: Set use_single_read regmap_config flag") Signed-off-by: Sasha Levin --- drivers/mfd/intel_soc_pmic_chtdc_ti.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mfd/intel_soc_pmic_chtdc_ti.c b/drivers/mfd/intel_soc_pmic_chtdc_ti.c index 64b5c3cc30e74..e787d5655a315 100644 --- a/drivers/mfd/intel_soc_pmic_chtdc_ti.c +++ b/drivers/mfd/intel_soc_pmic_chtdc_ti.c @@ -81,7 +81,7 @@ static struct mfd_cell chtdc_ti_dev[] = { static const struct regmap_config chtdc_ti_regmap_config = { .reg_bits = 8, .val_bits = 8, - .max_register = 128, + .max_register = 0xff, .cache_type = REGCACHE_NONE, }; -- 2.51.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id 2A4CIYG37Gg9CQIAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 08:25:37 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 08:25:37 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8Ds9-000000020ie-0zSx for hi@josie.lol; Mon, 13 Oct 2025 08:25:37 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4777A3A3CFE for ; Mon, 13 Oct 2025 08:25:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 51A5B2F3C07; Mon, 13 Oct 2025 08:25:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="CBl11OAh" X-Original-To: stable@vger.kernel.org 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 2B7F22F3C0C for ; Mon, 13 Oct 2025 08:25: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=1760343926; cv=none; b=nKyuzE040UNU5MhIaX0TFJReN9c9boiZOLnVVvPeDKuVHSsAwnMybbXvevIqgTebDh6oKlYQ+bAYVVEIKSxnmv72pYbQFjAveXN+8cfDmA7+P2J2KDhwRrjrypJuLCxnhfeZi2TICARggyULd94bEDtY4yFZxf71wWwZ26noyGk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760343926; c=relaxed/simple; bh=GZ5tdXgn6stR/AI/MzyRnKWL651TJE4otavGrm1OJFE=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=cTOe2FQp0oZdlj9bhuR8n+C7gFwB+TS8PyJDvMqZuhWIsVTYeoVd8TDo/rZxYOfWupqF+Tn4bsMdvLyr3Z2LomPR5vSjR5H1eKQw77JRdXLDmCysPviqRLkYqi6AufPqmutyyT/DEbE8wXzg/J4arsLJJpnv3McNTEYPzit/li8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=CBl11OAh; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A56CC4CEFE; Mon, 13 Oct 2025 08:25:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760343926; bh=GZ5tdXgn6stR/AI/MzyRnKWL651TJE4otavGrm1OJFE=; h=Subject:To:Cc:From:Date:From; b=CBl11OAhEApdsX6xrJvnaZqQr01zCqzM91ONfIlamS2u5OTAD0rRqHKwQd/hCm7wA rQW18BWw9HrHtvRiM2WGkt9c7RwewCuUWGvoL1kswVng6aqa6kBm011CzaL6mnrqvt 2fli9kFloDjmyzjTFbqkOaAkEXaumjsdCFjv5+xs= Subject: FAILED: patch "[PATCH] mfd: intel_soc_pmic_chtdc_ti: Set use_single_read" failed to apply to 5.4-stable tree To: hansg@kernel.org,andy@kernel.org,lee@kernel.org Cc: From: Date: Mon, 13 Oct 2025 10:25:16 +0200 Message-ID: <2025101316-disarm-pried-7a1f@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit X-DKIM: signer='linuxfoundation.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -18 The patch below does not apply to the 5.4-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.4.y git checkout FETCH_HEAD git cherry-pick -x 64e0d839c589f4f2ecd2e3e5bdb5cee6ba6bade9 # git commit -s git send-email --to '' --in-reply-to '2025101316-disarm-pried-7a1f@gregkh' --subject-prefix 'PATCH 5.4.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 64e0d839c589f4f2ecd2e3e5bdb5cee6ba6bade9 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 4 Aug 2025 15:32:40 +0200 Subject: [PATCH] mfd: intel_soc_pmic_chtdc_ti: Set use_single_read regmap_config flag Testing has shown that reading multiple registers at once (for 10-bit ADC values) does not work. Set the use_single_read regmap_config flag to make regmap split these for us. This should fix temperature opregion accesses done by drivers/acpi/pmic/intel_pmic_chtdc_ti.c and is also necessary for the upcoming drivers for the ADC and battery MFD cells. Fixes: 6bac0606fdba ("mfd: Add support for Cherry Trail Dollar Cove TI PMIC") Cc: stable@vger.kernel.org Reviewed-by: Andy Shevchenko Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20250804133240.312383-1-hansg@kernel.org Signed-off-by: Lee Jones diff --git a/drivers/mfd/intel_soc_pmic_chtdc_ti.c b/drivers/mfd/intel_soc_pmic_chtdc_ti.c index 4c1a68c9f575..6daf33e07ea0 100644 --- a/drivers/mfd/intel_soc_pmic_chtdc_ti.c +++ b/drivers/mfd/intel_soc_pmic_chtdc_ti.c @@ -82,6 +82,8 @@ static const struct regmap_config chtdc_ti_regmap_config = { .reg_bits = 8, .val_bits = 8, .max_register = 0xff, + /* The hardware does not support reading multiple registers at once */ + .use_single_read = true, }; static const struct regmap_irq chtdc_ti_irqs[] = { From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id CMEaA/KW7WgEFTsAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 00:18:58 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 00:18:58 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8Skj-0000000Gwvw-3R8l for hi@josie.lol; Tue, 14 Oct 2025 00:18:58 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id B8B2C4F315E for ; Tue, 14 Oct 2025 00:18:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 457942BF3CF; Tue, 14 Oct 2025 00:18:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EnxiU2wh" X-Original-To: stable@vger.kernel.org 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 171EF34BA5B; Tue, 14 Oct 2025 00:18:50 +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=1760401132; cv=none; b=qLTzUl9EMm2IjLGdDhU3ldfj+3r/OWH2+g2OOz5VL5Zm/srOP2M2Q2M6zm+QZL4GMZdRUo7JdAuHkOF1ioZqs/hiupxWC0t9MogHJdICZXM9GWhAN1Kg4YIusuA0c5SYE4hbUukpIPLObOD8TKqbESZzBpEHe0sF+l9dSLBAJLU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760401132; c=relaxed/simple; bh=Wj7cSLcyT0p0yvwLU7VLNGP20MDD+s64RMgH2Oq8gVw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=DoP66gMqGPjFl4TCUoWC9eG6Z9d+d0e+2uO3jJKuoGHpO2q0hGscYxRiRHD0vmk4azVhx55jULtMDlVd1pmIuYZlxfCm4b7aKCOS0B+whbENSeAClIuM0//OQ1OI0HWeKuJNKe8p4o/zuA23damxQPT+AVIv0QH9kCvdrNM9pj8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EnxiU2wh; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76584C4CEE7; Tue, 14 Oct 2025 00:18:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760401130; bh=Wj7cSLcyT0p0yvwLU7VLNGP20MDD+s64RMgH2Oq8gVw=; h=From:To:Cc:Subject:Date:From; b=EnxiU2whCnZHUhG3hop0501oo0Znua44eztBcxHHpcDKvqctxqoBaaULm3oZuJ6Fq QcuWIJMf0g3JJAMsAZ9xXnMUfpDF/VhkkcxRRTYnveOqNgcEELdDWjXZIQ1yAtWS6X x8clovOVioShD79aGcl4Maj896DiLcjFhyoIMacQPCdENh/f1D8CdU7cj5LyhiNlqk FqK4eOZ4zXYS3fFpYaVDta7X4FIME/JnjpKYx12Ap+up5OwKQq4M+3wUMMXkKx3CSs nUHCtwjKNsZpvXt61K1whz0slG3bN7VEZCiBlPZBRyVgTjURPedUxR0HGTnEeS3yt8 gUPSTBavfE3DA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , "# 6 . 16 . x" , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH] mm/damon/core: use damos_commit_quota_goal() for new goal commit Date: Mon, 13 Oct 2025 17:18:44 -0700 Message-ID: <20251014001846.279282-1-sj@kernel.org> X-Mailer: git-send-email 2.47.3 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.2 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.2 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -11 When a damos_commit_quota_goals() is called for adding new DAMOS quota goals of DAMOS_QUOTA_USER_INPUT metric, current_value fields of the new goals should be also set as requested. However, damos_commit_quota_goals() is not updating the field for the case, since it is setting only metrics and target values using damos_new_quota_goal(), and metric-optional union fields using damos_commit_quota_goal_union(). As a result, users could see the first current_value parameter that committed online with a new quota goal is ignored. Users are assumed to commit the current_value for DAMOS_QUOTA_USER_INPUT quota goals, since it is being used as a feedback. Hence the real impact would be subtle. That said, this is obviously not intended behavior. Fix the issue by using damos_commit_quota_goal() which sets all quota goal parameters, instead of damos_commit_quota_goal_union(), which sets only the union fields. Fixes: 1aef9df0ee90 ("mm/damon/core: commit damos_quota_goal->nid") Cc: # 6.16.x Signed-off-by: SeongJae Park --- mm/damon/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index 93848b4c6944..e72dc49d501c 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -832,7 +832,7 @@ int damos_commit_quota_goals(struct damos_quota *dst, struct damos_quota *src) src_goal->metric, src_goal->target_value); if (!new_goal) return -ENOMEM; - damos_commit_quota_goal_union(new_goal, src_goal); + damos_commit_quota_goal(new_goal, src_goal); damos_add_quota_goal(dst, new_goal); } return 0; base-commit: ccb48f0d949e274d388e66c8f80f7d1ff234ce46 -- 2.47.3 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id UGPUCQqX7WiWuzUAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 00:19:22 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 00:19:22 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8Sl7-0000000Gxcf-2PId for hi@josie.lol; Tue, 14 Oct 2025 00:19:22 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 74C43405828 for ; Tue, 14 Oct 2025 00:19:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1614A34BA5B; Tue, 14 Oct 2025 00:19:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TtmGvG9c" X-Original-To: stable@vger.kernel.org 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 E4D45218821 for ; Tue, 14 Oct 2025 00:19:19 +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=1760401160; cv=none; b=f/maelJ72kbF4r+jsZC7AezY7ocCaiT2Yl2G/V1oXPZ/KJRVV+vuXA/P/NaC0i1qhSb/7npjKGnz5FE2cnwK8aBR1gmHnPsI+7V0B/f4rebeiB7zHGXsxHfHUV7B1GA/K05pVfP5q0cYY9sx3XzNqIc0pGOVe9JCHSBrZ5vX5F0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760401160; c=relaxed/simple; bh=VYcG6clMhsrn46Jl8ySBMCeKbEadKWMOGFoQG8mIPWw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GruM4+FNXsVcER9pCXmYBHa3UrupcbtjeJZ8xJBXCLT4lc4aa/JckdrQqf9kKNttex+qadS2ta/hexhXp1crBRlGkMWy+Whh4nAA7eNUtIaRmqpzOPkif3wWttv938HeDeWuPLQScHHhwUwCF2wIZtqp8QFu1Iv991u9o8z0BgA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TtmGvG9c; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D93BCC4CEE7; Tue, 14 Oct 2025 00:19:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760401159; bh=VYcG6clMhsrn46Jl8ySBMCeKbEadKWMOGFoQG8mIPWw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TtmGvG9cLeaxfVM80610MZOzXY0RUQb6Dr/q1bstMFBDEGNuQP600G0k6Y1KwRo4C QYqIsXfQmLLw0EvQqIo0xqddR7BtGQ3LNDEnzJFVHx1xdF4/nNFo5camuX/mu4Pa54 j1W0e9GjpfbIsgRV7pPjQAaorAFG79hZpFbjxg18LgGR4aBlflAko1dLAuqD7pZQgW qFlXP8l2lChb5TNPmE2Rteg79GCj5OJSbQGh+ZlqF/jA7fFcGUds9yEGn7HEmUZK4e t0ixVeKPiw3i503fEEpStrqY2BecHar8rF+pnoECFGBBWLsXbPl7/kWr2rOkGeMzaL xtZvm1nJrpHyw== From: Sasha Levin To: stable@vger.kernel.org Cc: Yuan Chen , "Masami Hiramatsu (Google)" , Sasha Levin Subject: [PATCH 6.12.y] tracing: Fix race condition in kprobe initialization causing NULL pointer dereference Date: Mon, 13 Oct 2025 20:19:15 -0400 Message-ID: <20251014001915.3749537-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2025101316-morse-diary-ea9a@gregkh> References: <2025101316-morse-diary-ea9a@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.2 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.2 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -11 From: Yuan Chen [ Upstream commit 9cf9aa7b0acfde7545c1a1d912576e9bab28dc6f ] There is a critical race condition in kprobe initialization that can lead to NULL pointer dereference and kernel crash. [1135630.084782] Unable to handle kernel paging request at virtual address 0000710a04630000 ... [1135630.260314] pstate: 404003c9 (nZcv DAIF +PAN -UAO) [1135630.269239] pc : kprobe_perf_func+0x30/0x260 [1135630.277643] lr : kprobe_dispatcher+0x44/0x60 [1135630.286041] sp : ffffaeff4977fa40 [1135630.293441] x29: ffffaeff4977fa40 x28: ffffaf015340e400 [1135630.302837] x27: 0000000000000000 x26: 0000000000000000 [1135630.312257] x25: ffffaf029ed108a8 x24: ffffaf015340e528 [1135630.321705] x23: ffffaeff4977fc50 x22: ffffaeff4977fc50 [1135630.331154] x21: 0000000000000000 x20: ffffaeff4977fc50 [1135630.340586] x19: ffffaf015340e400 x18: 0000000000000000 [1135630.349985] x17: 0000000000000000 x16: 0000000000000000 [1135630.359285] x15: 0000000000000000 x14: 0000000000000000 [1135630.368445] x13: 0000000000000000 x12: 0000000000000000 [1135630.377473] x11: 0000000000000000 x10: 0000000000000000 [1135630.386411] x9 : 0000000000000000 x8 : 0000000000000000 [1135630.395252] x7 : 0000000000000000 x6 : 0000000000000000 [1135630.403963] x5 : 0000000000000000 x4 : 0000000000000000 [1135630.412545] x3 : 0000710a04630000 x2 : 0000000000000006 [1135630.421021] x1 : ffffaeff4977fc50 x0 : 0000710a04630000 [1135630.429410] Call trace: [1135630.434828] kprobe_perf_func+0x30/0x260 [1135630.441661] kprobe_dispatcher+0x44/0x60 [1135630.448396] aggr_pre_handler+0x70/0xc8 [1135630.454959] kprobe_breakpoint_handler+0x140/0x1e0 [1135630.462435] brk_handler+0xbc/0xd8 [1135630.468437] do_debug_exception+0x84/0x138 [1135630.475074] el1_dbg+0x18/0x8c [1135630.480582] security_file_permission+0x0/0xd0 [1135630.487426] vfs_write+0x70/0x1c0 [1135630.493059] ksys_write+0x5c/0xc8 [1135630.498638] __arm64_sys_write+0x24/0x30 [1135630.504821] el0_svc_common+0x78/0x130 [1135630.510838] el0_svc_handler+0x38/0x78 [1135630.516834] el0_svc+0x8/0x1b0 kernel/trace/trace_kprobe.c: 1308 0xffff3df8995039ec : ldr x21, [x24,#120] include/linux/compiler.h: 294 0xffff3df8995039f0 : ldr x1, [x21,x0] kernel/trace/trace_kprobe.c 1308: head = this_cpu_ptr(call->perf_events); 1309: if (hlist_empty(head)) 1310: return 0; crash> struct trace_event_call -o struct trace_event_call { ... [120] struct hlist_head *perf_events; //(call->perf_event) ... } crash> struct trace_event_call ffffaf015340e528 struct trace_event_call { ... perf_events = 0xffff0ad5fa89f088, //this value is correct, but x21 = 0 ... } Race Condition Analysis: The race occurs between kprobe activation and perf_events initialization: CPU0 CPU1 ==== ==== perf_kprobe_init perf_trace_event_init tp_event->perf_events = list;(1) tp_event->class->reg (2)← KPROBE ACTIVE Debug exception triggers ... kprobe_dispatcher kprobe_perf_func (tk->tp.flags & TP_FLAG_PROFILE) head = this_cpu_ptr(call->perf_events)(3) (perf_events is still NULL) Problem: 1. CPU0 executes (1) assigning tp_event->perf_events = list 2. CPU0 executes (2) enabling kprobe functionality via class->reg() 3. CPU1 triggers and reaches kprobe_dispatcher 4. CPU1 checks TP_FLAG_PROFILE - condition passes (step 2 completed) 5. CPU1 calls kprobe_perf_func() and crashes at (3) because call->perf_events is still NULL CPU1 sees that kprobe functionality is enabled but does not see that perf_events has been assigned. Add pairing read and write memory barriers to guarantee that if CPU1 sees that kprobe functionality is enabled, it must also see that perf_events has been assigned. Link: https://lore.kernel.org/all/20251001022025.44626-1-chenyuan_fl@163.com/ Fixes: 50d780560785 ("tracing/kprobes: Add probe handler dispatcher to support perf and ftrace concurrent use") Cc: stable@vger.kernel.org Signed-off-by: Yuan Chen Signed-off-by: Masami Hiramatsu (Google) [ Adjust context ] Signed-off-by: Sasha Levin --- kernel/trace/trace_fprobe.c | 11 +++++++---- kernel/trace/trace_kprobe.c | 11 +++++++---- kernel/trace/trace_probe.h | 9 +++++++-- kernel/trace/trace_uprobe.c | 12 ++++++++---- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/kernel/trace/trace_fprobe.c b/kernel/trace/trace_fprobe.c index af7d6e2060d9d..440dbfa6bbfd5 100644 --- a/kernel/trace/trace_fprobe.c +++ b/kernel/trace/trace_fprobe.c @@ -343,12 +343,14 @@ static int fentry_dispatcher(struct fprobe *fp, unsigned long entry_ip, void *entry_data) { struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp); + unsigned int flags = trace_probe_load_flag(&tf->tp); int ret = 0; - if (trace_probe_test_flag(&tf->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) fentry_trace_func(tf, entry_ip, regs); + #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tf->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret = fentry_perf_func(tf, entry_ip, regs); #endif return ret; @@ -360,11 +362,12 @@ static void fexit_dispatcher(struct fprobe *fp, unsigned long entry_ip, void *entry_data) { struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp); + unsigned int flags = trace_probe_load_flag(&tf->tp); - if (trace_probe_test_flag(&tf->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) fexit_trace_func(tf, entry_ip, ret_ip, regs, entry_data); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tf->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) fexit_perf_func(tf, entry_ip, ret_ip, regs, entry_data); #endif } diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index 6b9c3f3f870f4..b273611c5026c 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -1799,14 +1799,15 @@ static int kprobe_register(struct trace_event_call *event, static int kprobe_dispatcher(struct kprobe *kp, struct pt_regs *regs) { struct trace_kprobe *tk = container_of(kp, struct trace_kprobe, rp.kp); + unsigned int flags = trace_probe_load_flag(&tk->tp); int ret = 0; raw_cpu_inc(*tk->nhit); - if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) kprobe_trace_func(tk, regs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret = kprobe_perf_func(tk, regs); #endif return ret; @@ -1818,6 +1819,7 @@ kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) { struct kretprobe *rp = get_kretprobe(ri); struct trace_kprobe *tk; + unsigned int flags; /* * There is a small chance that get_kretprobe(ri) returns NULL when @@ -1830,10 +1832,11 @@ kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) tk = container_of(rp, struct trace_kprobe, rp); raw_cpu_inc(*tk->nhit); - if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tk->tp); + if (flags & TP_FLAG_TRACE) kretprobe_trace_func(tk, ri, regs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) kretprobe_perf_func(tk, ri, regs); #endif return 0; /* We don't tweak kernel, so just return 0 */ diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h index 8a6797c2278d9..4f54f7935d5db 100644 --- a/kernel/trace/trace_probe.h +++ b/kernel/trace/trace_probe.h @@ -269,16 +269,21 @@ struct event_file_link { struct list_head list; }; +static inline unsigned int trace_probe_load_flag(struct trace_probe *tp) +{ + return smp_load_acquire(&tp->event->flags); +} + static inline bool trace_probe_test_flag(struct trace_probe *tp, unsigned int flag) { - return !!(tp->event->flags & flag); + return !!(trace_probe_load_flag(tp) & flag); } static inline void trace_probe_set_flag(struct trace_probe *tp, unsigned int flag) { - tp->event->flags |= flag; + smp_store_release(&tp->event->flags, tp->event->flags | flag); } static inline void trace_probe_clear_flag(struct trace_probe *tp, diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index 9916677acf24e..f210e71bc1550 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c @@ -1531,6 +1531,7 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs) struct trace_uprobe *tu; struct uprobe_dispatch_data udd; struct uprobe_cpu_buffer *ucb = NULL; + unsigned int flags; int ret = 0; tu = container_of(con, struct trace_uprobe, consumer); @@ -1545,11 +1546,12 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs) if (WARN_ON_ONCE(!uprobe_cpu_buffer)) return 0; - if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tu->tp); + if (flags & TP_FLAG_TRACE) ret |= uprobe_trace_func(tu, regs, &ucb); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret |= uprobe_perf_func(tu, regs, &ucb); #endif uprobe_buffer_put(ucb); @@ -1562,6 +1564,7 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, struct trace_uprobe *tu; struct uprobe_dispatch_data udd; struct uprobe_cpu_buffer *ucb = NULL; + unsigned int flags; tu = container_of(con, struct trace_uprobe, consumer); @@ -1573,11 +1576,12 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, if (WARN_ON_ONCE(!uprobe_cpu_buffer)) return 0; - if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tu->tp); + if (flags & TP_FLAG_TRACE) uretprobe_trace_func(tu, func, regs, &ucb); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) uretprobe_perf_func(tu, func, regs, &ucb); #endif uprobe_buffer_put(ucb); -- 2.51.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id GOqyNrG37Gh15gUAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 08:26:25 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 08:26:25 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8Dsv-0000000228B-0Rt5 for hi@josie.lol; Mon, 13 Oct 2025 08:26:25 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 778B7188E46E for ; Mon, 13 Oct 2025 08:26:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D23BF2D0C8F; Mon, 13 Oct 2025 08:26:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="b2hMOfSn" X-Original-To: stable@vger.kernel.org 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 AE1FB2C11E5 for ; Mon, 13 Oct 2025 08:26:19 +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=1760343979; cv=none; b=h1Job6DVYe2B5xmL0sw5OBNT2ORmtJTDd4lpkYwI/A+PDOOkTqM2nwbpBr2EHgDkqAOJPSTltk3oR0LXk53ag6So4bJbfyZerUM/Tn/mNc1t8lhvdWsyUE2wfns+IvElYnAAb+qNL2lwwTjciX7XYRveyMmrbYPGNbgk9uKhSZg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760343979; c=relaxed/simple; bh=tyH+qGe6cEpL/sNEudqcOyH4AMYWoMpaMLw4G5Ny/GE=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=Ub1unb/dGvuezYTTstbj51vHrpuU4xf5BVLRLhrB5/AXUMs2MoQ2wuP34ErEpch5/gIGOvTly+rP7cb1BqqDYO+Ak/qvhLxmzb3O/9b3If7vw1JeN+VL3vLlwfk4zDEn9rh0bxKtCXFhSV4fbym9nyMpgxe1p7xjWItV9lXsjmY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=b2hMOfSn; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38A3AC4CEE7; Mon, 13 Oct 2025 08:26:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760343979; bh=tyH+qGe6cEpL/sNEudqcOyH4AMYWoMpaMLw4G5Ny/GE=; h=Subject:To:Cc:From:Date:From; b=b2hMOfSne9Vj48V2XfIA4RvS3vFTk3uZneKHZNvY1j3269sExW67oHsZhFrGzs970 p0NJgV9hFt6o8sNOCBrD82bRoj3Qn1T8yMlqVO3GwJxFG23sxXxxxbxqpqxi1z5YtZ OvhO0739/CYv2TIltFyzf+ljuiZTJxeWtHYTcbMQ= Subject: FAILED: patch "[PATCH] tracing: Fix race condition in kprobe initialization causing" failed to apply to 6.12-stable tree To: chenyuan@kylinos.cn,mhiramat@kernel.org Cc: From: Date: Mon, 13 Oct 2025 10:26:17 +0200 Message-ID: <2025101316-morse-diary-ea9a@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-DKIM: signer='linuxfoundation.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linuxfoundation.org] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [147.75.80.249 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -18 The patch below does not apply to the 6.12-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y git checkout FETCH_HEAD git cherry-pick -x 9cf9aa7b0acfde7545c1a1d912576e9bab28dc6f # git commit -s git send-email --to '' --in-reply-to '2025101316-morse-diary-ea9a@gregkh' --subject-prefix 'PATCH 6.12.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 9cf9aa7b0acfde7545c1a1d912576e9bab28dc6f Mon Sep 17 00:00:00 2001 From: Yuan Chen Date: Wed, 1 Oct 2025 03:20:25 +0100 Subject: [PATCH] tracing: Fix race condition in kprobe initialization causing NULL pointer dereference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is a critical race condition in kprobe initialization that can lead to NULL pointer dereference and kernel crash. [1135630.084782] Unable to handle kernel paging request at virtual address 0000710a04630000 ... [1135630.260314] pstate: 404003c9 (nZcv DAIF +PAN -UAO) [1135630.269239] pc : kprobe_perf_func+0x30/0x260 [1135630.277643] lr : kprobe_dispatcher+0x44/0x60 [1135630.286041] sp : ffffaeff4977fa40 [1135630.293441] x29: ffffaeff4977fa40 x28: ffffaf015340e400 [1135630.302837] x27: 0000000000000000 x26: 0000000000000000 [1135630.312257] x25: ffffaf029ed108a8 x24: ffffaf015340e528 [1135630.321705] x23: ffffaeff4977fc50 x22: ffffaeff4977fc50 [1135630.331154] x21: 0000000000000000 x20: ffffaeff4977fc50 [1135630.340586] x19: ffffaf015340e400 x18: 0000000000000000 [1135630.349985] x17: 0000000000000000 x16: 0000000000000000 [1135630.359285] x15: 0000000000000000 x14: 0000000000000000 [1135630.368445] x13: 0000000000000000 x12: 0000000000000000 [1135630.377473] x11: 0000000000000000 x10: 0000000000000000 [1135630.386411] x9 : 0000000000000000 x8 : 0000000000000000 [1135630.395252] x7 : 0000000000000000 x6 : 0000000000000000 [1135630.403963] x5 : 0000000000000000 x4 : 0000000000000000 [1135630.412545] x3 : 0000710a04630000 x2 : 0000000000000006 [1135630.421021] x1 : ffffaeff4977fc50 x0 : 0000710a04630000 [1135630.429410] Call trace: [1135630.434828] kprobe_perf_func+0x30/0x260 [1135630.441661] kprobe_dispatcher+0x44/0x60 [1135630.448396] aggr_pre_handler+0x70/0xc8 [1135630.454959] kprobe_breakpoint_handler+0x140/0x1e0 [1135630.462435] brk_handler+0xbc/0xd8 [1135630.468437] do_debug_exception+0x84/0x138 [1135630.475074] el1_dbg+0x18/0x8c [1135630.480582] security_file_permission+0x0/0xd0 [1135630.487426] vfs_write+0x70/0x1c0 [1135630.493059] ksys_write+0x5c/0xc8 [1135630.498638] __arm64_sys_write+0x24/0x30 [1135630.504821] el0_svc_common+0x78/0x130 [1135630.510838] el0_svc_handler+0x38/0x78 [1135630.516834] el0_svc+0x8/0x1b0 kernel/trace/trace_kprobe.c: 1308 0xffff3df8995039ec : ldr x21, [x24,#120] include/linux/compiler.h: 294 0xffff3df8995039f0 : ldr x1, [x21,x0] kernel/trace/trace_kprobe.c 1308: head = this_cpu_ptr(call->perf_events); 1309: if (hlist_empty(head)) 1310: return 0; crash> struct trace_event_call -o struct trace_event_call { ... [120] struct hlist_head *perf_events; //(call->perf_event) ... } crash> struct trace_event_call ffffaf015340e528 struct trace_event_call { ... perf_events = 0xffff0ad5fa89f088, //this value is correct, but x21 = 0 ... } Race Condition Analysis: The race occurs between kprobe activation and perf_events initialization: CPU0 CPU1 ==== ==== perf_kprobe_init perf_trace_event_init tp_event->perf_events = list;(1) tp_event->class->reg (2)← KPROBE ACTIVE Debug exception triggers ... kprobe_dispatcher kprobe_perf_func (tk->tp.flags & TP_FLAG_PROFILE) head = this_cpu_ptr(call->perf_events)(3) (perf_events is still NULL) Problem: 1. CPU0 executes (1) assigning tp_event->perf_events = list 2. CPU0 executes (2) enabling kprobe functionality via class->reg() 3. CPU1 triggers and reaches kprobe_dispatcher 4. CPU1 checks TP_FLAG_PROFILE - condition passes (step 2 completed) 5. CPU1 calls kprobe_perf_func() and crashes at (3) because call->perf_events is still NULL CPU1 sees that kprobe functionality is enabled but does not see that perf_events has been assigned. Add pairing read and write memory barriers to guarantee that if CPU1 sees that kprobe functionality is enabled, it must also see that perf_events has been assigned. Link: https://lore.kernel.org/all/20251001022025.44626-1-chenyuan_fl@163.com/ Fixes: 50d780560785 ("tracing/kprobes: Add probe handler dispatcher to support perf and ftrace concurrent use") Cc: stable@vger.kernel.org Signed-off-by: Yuan Chen Signed-off-by: Masami Hiramatsu (Google) diff --git a/kernel/trace/trace_fprobe.c b/kernel/trace/trace_fprobe.c index b36ade43d4b3..ad9d6347b5fa 100644 --- a/kernel/trace/trace_fprobe.c +++ b/kernel/trace/trace_fprobe.c @@ -522,13 +522,14 @@ static int fentry_dispatcher(struct fprobe *fp, unsigned long entry_ip, void *entry_data) { struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp); + unsigned int flags = trace_probe_load_flag(&tf->tp); int ret = 0; - if (trace_probe_test_flag(&tf->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) fentry_trace_func(tf, entry_ip, fregs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tf->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret = fentry_perf_func(tf, entry_ip, fregs); #endif return ret; @@ -540,11 +541,12 @@ static void fexit_dispatcher(struct fprobe *fp, unsigned long entry_ip, void *entry_data) { struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp); + unsigned int flags = trace_probe_load_flag(&tf->tp); - if (trace_probe_test_flag(&tf->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) fexit_trace_func(tf, entry_ip, ret_ip, fregs, entry_data); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tf->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) fexit_perf_func(tf, entry_ip, ret_ip, fregs, entry_data); #endif } diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index fa60362a3f31..ee8171b19bee 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -1815,14 +1815,15 @@ static int kprobe_register(struct trace_event_call *event, static int kprobe_dispatcher(struct kprobe *kp, struct pt_regs *regs) { struct trace_kprobe *tk = container_of(kp, struct trace_kprobe, rp.kp); + unsigned int flags = trace_probe_load_flag(&tk->tp); int ret = 0; raw_cpu_inc(*tk->nhit); - if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) kprobe_trace_func(tk, regs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret = kprobe_perf_func(tk, regs); #endif return ret; @@ -1834,6 +1835,7 @@ kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) { struct kretprobe *rp = get_kretprobe(ri); struct trace_kprobe *tk; + unsigned int flags; /* * There is a small chance that get_kretprobe(ri) returns NULL when @@ -1846,10 +1848,11 @@ kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) tk = container_of(rp, struct trace_kprobe, rp); raw_cpu_inc(*tk->nhit); - if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tk->tp); + if (flags & TP_FLAG_TRACE) kretprobe_trace_func(tk, ri, regs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) kretprobe_perf_func(tk, ri, regs); #endif return 0; /* We don't tweak kernel, so just return 0 */ diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h index 842383fbc03b..08b5bda24da2 100644 --- a/kernel/trace/trace_probe.h +++ b/kernel/trace/trace_probe.h @@ -271,16 +271,21 @@ struct event_file_link { struct list_head list; }; +static inline unsigned int trace_probe_load_flag(struct trace_probe *tp) +{ + return smp_load_acquire(&tp->event->flags); +} + static inline bool trace_probe_test_flag(struct trace_probe *tp, unsigned int flag) { - return !!(tp->event->flags & flag); + return !!(trace_probe_load_flag(tp) & flag); } static inline void trace_probe_set_flag(struct trace_probe *tp, unsigned int flag) { - tp->event->flags |= flag; + smp_store_release(&tp->event->flags, tp->event->flags | flag); } static inline void trace_probe_clear_flag(struct trace_probe *tp, diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index 8b0bcc0d8f41..430d09c49462 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c @@ -1547,6 +1547,7 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs, struct trace_uprobe *tu; struct uprobe_dispatch_data udd; struct uprobe_cpu_buffer *ucb = NULL; + unsigned int flags; int ret = 0; tu = container_of(con, struct trace_uprobe, consumer); @@ -1561,11 +1562,12 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs, if (WARN_ON_ONCE(!uprobe_cpu_buffer)) return 0; - if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tu->tp); + if (flags & TP_FLAG_TRACE) ret |= uprobe_trace_func(tu, regs, &ucb); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret |= uprobe_perf_func(tu, regs, &ucb); #endif uprobe_buffer_put(ucb); @@ -1579,6 +1581,7 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, struct trace_uprobe *tu; struct uprobe_dispatch_data udd; struct uprobe_cpu_buffer *ucb = NULL; + unsigned int flags; tu = container_of(con, struct trace_uprobe, consumer); @@ -1590,11 +1593,12 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, if (WARN_ON_ONCE(!uprobe_cpu_buffer)) return 0; - if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tu->tp); + if (flags & TP_FLAG_TRACE) uretprobe_trace_func(tu, func, regs, &ucb); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) uretprobe_perf_func(tu, func, regs, &ucb); #endif uprobe_buffer_put(ucb); From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id mD14IDaX7WifLj0AYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 00:20:06 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 00:20:06 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8Slq-0000000Gz7t-0tLS for hi@josie.lol; Tue, 14 Oct 2025 00:20:06 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 74727405341 for ; Tue, 14 Oct 2025 00:20:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 05BCE2BF3CF; Tue, 14 Oct 2025 00:20:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SoKTJB2z" X-Original-To: stable@vger.kernel.org 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 D57D3218821 for ; Tue, 14 Oct 2025 00:20:02 +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=1760401202; cv=none; b=ptO8IML/tcmG0FtzWcodmjfdj4u/92s6hwAsuBIyrMEe48JuL0QE4D3w+FLdRjcWJ/EvxgV630XCDlJLBx3Y5Dcrt0tGV6a3Odn7swKVf+4kdo8WoXBmUfBoJpBY2FzHzxOybRhEMm3trHymYe1WeGUESP7dOKZzbNd3Lem9Ffg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760401202; c=relaxed/simple; bh=kkeO3cevuyV78fmnY3yyIk9+JKidFaXixgFoZjzu60s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a7Na1h5WOzsgrPPcsylwRpDeEzUSOwHkJMMd3g8XqdgfxD2TGVX8kzlfa++OZL3uJg0LLwvzZCxvxqtspMH5A1P6yqoNaSKkSt5dKLmUpZ7BALHpKoJwfspb6qXSVYqWhBK+bU4LxmsdHjCIbAtkxb+dLJ1r43r54BHohDJ5ELc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SoKTJB2z; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FA43C4CEE7; Tue, 14 Oct 2025 00:20:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760401202; bh=kkeO3cevuyV78fmnY3yyIk9+JKidFaXixgFoZjzu60s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SoKTJB2zqXJfcxXK/xtWLr/PalFba6qhJvkCljei5izcg8Y/9UYKYC4i+bWQNBmEK zeJwuQfLknf2tvAh1f8+lQ0plqY8rGLwlIaCszisOqYy8dmixAYjymrAhiEoybsFCg OdXPWnf5idEaWCVo8+lMbHIhvH3W/K8+BBwP/KY75ZlzHnxJBJO4sQuo/FNmGBoCL2 ndQQHAtO+6lkGJ46hOGBrdvndbmoz4zfWxxFGWCK0Rnfp0epRIB/Jj8G/UD4/Rv6lg JhTaogU03AQxyJxN5hK3VJDlLweCrlhuAr/gejvDCsBrGRBAvhRZB5lzDtfXoInlDr 7rncD2YoqltOw== From: Sasha Levin To: stable@vger.kernel.org Cc: Bartosz Golaszewski , Linus Walleij , Lee Jones , Sasha Levin Subject: [PATCH 5.4.y] mfd: vexpress-sysreg: Check the return value of devm_gpiochip_add_data() Date: Mon, 13 Oct 2025 20:20:00 -0400 Message-ID: <20251014002000.3750354-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2025101336-abrasion-hatchling-01bc@gregkh> References: <2025101336-abrasion-hatchling-01bc@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.2 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.2 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -11 From: Bartosz Golaszewski [ Upstream commit 1efbee6852f1ff698a9981bd731308dd027189fb ] Commit 974cc7b93441 ("mfd: vexpress: Define the device as MFD cells") removed the return value check from the call to gpiochip_add_data() (or rather gpiochip_add() back then and later converted to devres) with no explanation. This function however can still fail, so check the return value and bail-out if it does. Cc: stable@vger.kernel.org Fixes: 974cc7b93441 ("mfd: vexpress: Define the device as MFD cells") Signed-off-by: Bartosz Golaszewski Reviewed-by: Linus Walleij Link: https://lore.kernel.org/r/20250811-gpio-mmio-mfd-conv-v1-1-68c5c958cf80@linaro.org Signed-off-by: Lee Jones [ Use non-devm variants ] Signed-off-by: Sasha Levin --- drivers/mfd/vexpress-sysreg.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/vexpress-sysreg.c b/drivers/mfd/vexpress-sysreg.c index c68ff56dbdb12..1463cf43687df 100644 --- a/drivers/mfd/vexpress-sysreg.c +++ b/drivers/mfd/vexpress-sysreg.c @@ -160,6 +160,7 @@ static int vexpress_sysreg_probe(struct platform_device *pdev) struct gpio_chip *mmc_gpio_chip; int master; u32 dt_hbi; + int ret; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem) @@ -195,7 +196,10 @@ static int vexpress_sysreg_probe(struct platform_device *pdev) bgpio_init(mmc_gpio_chip, &pdev->dev, 0x4, base + SYS_MCI, NULL, NULL, NULL, NULL, 0); mmc_gpio_chip->ngpio = 2; - gpiochip_add_data(mmc_gpio_chip, NULL); + + ret = gpiochip_add_data(mmc_gpio_chip, NULL); + if (ret) + return ret; return mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO, vexpress_sysreg_cells, -- 2.51.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id qKZ/Hai37GhWOgYAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 08:26:16 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 08:26:16 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8Dsm-000000021s1-0wdY for hi@josie.lol; Mon, 13 Oct 2025 08:26:16 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id EF8ED4EDF0F for ; Mon, 13 Oct 2025 08:25:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 097E82F2902; Mon, 13 Oct 2025 08:25:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="LVVeaEPC" X-Original-To: stable@vger.kernel.org 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 D9EC62F28FF for ; Mon, 13 Oct 2025 08:25:38 +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=1760343938; cv=none; b=l68z1bN4oVbt8VwS8VFEOKmuOzlOQfDBIYrzpOY0XGWsFCGwB9MEZFhZ1ZKHSrBaQoWjgGnEyRXmMDMI9lmAPUA3spk66ruIkgVfFZKl1Q8itbZuor2wnii4znnWRJgqip9ckJr+gA6MUgkOf4UYy0lmCRShDgQIBlZjf/a6b+k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760343938; c=relaxed/simple; bh=CTtMgmnKQnUTz4H7BoCsg+dAe7Y/G112fjA/QhWfPOE=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=if+8Ce+KW0ePQQrKOaW5Dlf1kiv/VAg8soMdFmG6D/WqJeY0jU76myZVytCXrSkRS4C+6iJaqskxGv+7kNX4eREnEAbUmuR+KNUOd/CeuNPN9WTYUFzuQ7v/oEaFhWOGn19my6GlsUH9yFcvcUuIcnDsKlXVdy2mJsdzeyEVOmM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=LVVeaEPC; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60BD2C116D0; Mon, 13 Oct 2025 08:25:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760343938; bh=CTtMgmnKQnUTz4H7BoCsg+dAe7Y/G112fjA/QhWfPOE=; h=Subject:To:Cc:From:Date:From; b=LVVeaEPCHZ76UxlDGYzwhM0g2JHRs+MXUv3yB+2nyhkfy9kqOUOKrVGWHlTaz4cht QB9KwAnPf/c2IdOXQhj7g1DAg1lADAcuQyKzrmqBdYAdFkXxI393/WjZsEL9G3vT6Q Du2o2/EAMYV8S20FuqhPr1tgBtAfYd+ejLB/YnoI= Subject: FAILED: patch "[PATCH] mfd: vexpress-sysreg: Check the return value of" failed to apply to 5.4-stable tree To: bartosz.golaszewski@linaro.org,lee@kernel.org,linus.walleij@linaro.org Cc: From: Date: Mon, 13 Oct 2025 10:25:36 +0200 Message-ID: <2025101336-abrasion-hatchling-01bc@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit X-DKIM: signer='linuxfoundation.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: 4 The patch below does not apply to the 5.4-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.4.y git checkout FETCH_HEAD git cherry-pick -x 1efbee6852f1ff698a9981bd731308dd027189fb # git commit -s git send-email --to '' --in-reply-to '2025101336-abrasion-hatchling-01bc@gregkh' --subject-prefix 'PATCH 5.4.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 1efbee6852f1ff698a9981bd731308dd027189fb Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Mon, 11 Aug 2025 15:36:16 +0200 Subject: [PATCH] mfd: vexpress-sysreg: Check the return value of devm_gpiochip_add_data() Commit 974cc7b93441 ("mfd: vexpress: Define the device as MFD cells") removed the return value check from the call to gpiochip_add_data() (or rather gpiochip_add() back then and later converted to devres) with no explanation. This function however can still fail, so check the return value and bail-out if it does. Cc: stable@vger.kernel.org Fixes: 974cc7b93441 ("mfd: vexpress: Define the device as MFD cells") Signed-off-by: Bartosz Golaszewski Reviewed-by: Linus Walleij Link: https://lore.kernel.org/r/20250811-gpio-mmio-mfd-conv-v1-1-68c5c958cf80@linaro.org Signed-off-by: Lee Jones diff --git a/drivers/mfd/vexpress-sysreg.c b/drivers/mfd/vexpress-sysreg.c index fc2daffc4352..77245c1e5d7d 100644 --- a/drivers/mfd/vexpress-sysreg.c +++ b/drivers/mfd/vexpress-sysreg.c @@ -99,6 +99,7 @@ static int vexpress_sysreg_probe(struct platform_device *pdev) struct resource *mem; void __iomem *base; struct gpio_chip *mmc_gpio_chip; + int ret; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem) @@ -119,7 +120,10 @@ static int vexpress_sysreg_probe(struct platform_device *pdev) bgpio_init(mmc_gpio_chip, &pdev->dev, 0x4, base + SYS_MCI, NULL, NULL, NULL, NULL, 0); mmc_gpio_chip->ngpio = 2; - devm_gpiochip_add_data(&pdev->dev, mmc_gpio_chip, NULL); + + ret = devm_gpiochip_add_data(&pdev->dev, mmc_gpio_chip, NULL); + if (ret) + return ret; return devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO, vexpress_sysreg_cells, From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id YFD0KLmv7WguvgUAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 02:04:41 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 02:04:41 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8UP2-00000002tNw-3l6a for hi@josie.lol; Tue, 14 Oct 2025 02:04:41 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 40FF84EB21F for ; Tue, 14 Oct 2025 02:04:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A9257303A24; Tue, 14 Oct 2025 02:04:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="aPAKJ8Im" X-Original-To: linux-s390@vger.kernel.org Received: from out30-124.freemail.mail.aliyun.com (out30-124.freemail.mail.aliyun.com [115.124.30.124]) (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 3C072DDAB; Tue, 14 Oct 2025 02:04:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760407475; cv=none; b=mz/OSMA8iQZPPH1M/JvypatU/CgImnBmvgfHurGCq2NxS1QIA0UO+HtT/N1B76lKRIIJgXCCo4m7RTfjEthZP9bKwg69uic9WSfLLR5pQKomGJJcoc9jcrb9dUsMGC9YJg7b6L5kCPJBlISPShOCem5+lc++5qadUy0t1tH/8m4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760407475; c=relaxed/simple; bh=dww80B3Hk7HPkJ5DlFsPZ2Wkdo+EJLE2Aw1BA4evdsk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Wto4RfpiSzPkLnwQDv9Ku/NnWN0+Y5VmNGiCUiOFkABMRmu6Qr0i43kd/QvWO/3DnNf6YJPg1NATO3LW2hRO0LO8hO/HDelG9WD5JgunZXjo1Tt6ZUUnPfxbVulEYtmVLDoLwzRSzntIdXuetkOpLscHoa1I/zsMeNrwQdxRMPA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=aPAKJ8Im; arc=none smtp.client-ip=115.124.30.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1760407468; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type; bh=NC6lAq5v+naNOL8xOJgDemeTBmw5nvWnLwrWkWNVO60=; b=aPAKJ8ImAoAehFNTbdRkyxle/vDDcbTQuP8WP9BnWDLcCRyIMBk4tc8xATDtoAUIrgOzgvK/FdjaMrivCppbFkeui6wdCb6Y7yyjzln5i+p8ymrqRm7RjXoYNUgV+5QfYrq5Wm7R4UBhBE/5dGLO7mw9R62e9aiAbEjpJXTqDoQ= Received: from localhost(mailfrom:alibuda@linux.alibaba.com fp:SMTPD_---0WqA-Nit_1760407467 cluster:ay36) by smtp.aliyun-inc.com; Tue, 14 Oct 2025 10:04:28 +0800 Date: Tue, 14 Oct 2025 10:04:27 +0800 From: "D. Wythe" To: Wang Liang Cc: Kuniyuki Iwashima , Eric Dumazet , alibuda@linux.alibaba.com, dust.li@linux.alibaba.com, sidraya@linux.ibm.com, wenjia@linux.ibm.com, mjambigi@linux.ibm.com, tonylu@linux.alibaba.com, guwen@linux.alibaba.com, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, yuehaibing@huawei.com, zhangchangzhong@huawei.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org Subject: Re: [PATCH net] net/smc: fix general protection fault in __smc_diag_dump Message-ID: <20251014020427.GA109537@j66a10360.sqa.eu95> References: <20250922121818.654011-1-wangliang74@huawei.com> <8ab4d343-d287-4b42-94f7-511f46e131d3@huawei.com> Precedence: bulk X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <8ab4d343-d287-4b42-94f7-511f46e131d3@huawei.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-DKIM: signer='linux.alibaba.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 2.4 (++) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (2.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: syzkaller.appspot.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 2.0 FROM_WSP_TRAIL Trailing whitespace before '>' in From header field 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager 0.0 FROM_ADDR_WS Malformed From address SpamTally: Final spam score: 24 On Fri, Sep 26, 2025 at 04:42:35PM +0800, Wang Liang wrote: > > 在 2025/9/26 3:51, Kuniyuki Iwashima 写道: > >On Thu, Sep 25, 2025 at 12:37 PM Eric Dumazet wrote: > >>On Thu, Sep 25, 2025 at 12:25 PM Kuniyuki Iwashima wrote: > >>>On Thu, Sep 25, 2025 at 11:54 AM Eric Dumazet wrote: > >>>>On Thu, Sep 25, 2025 at 11:46 AM Kuniyuki Iwashima wrote: > >>>>>Thanks Eric for CCing me. > >>>>> > >>>>>On Thu, Sep 25, 2025 at 7:32 AM Eric Dumazet wrote: > >>>>>>On Mon, Sep 22, 2025 at 4:57 AM Wang Liang wrote: > >>>>>>>The syzbot report a crash: > >>>>>>> > >>>>>>> Oops: general protection fault, probably for non-canonical address 0xfbd5a5d5a0000003: 0000 [#1] SMP KASAN NOPTI > >>>>>>> KASAN: maybe wild-memory-access in range [0xdead4ead00000018-0xdead4ead0000001f] > >>>>>>> CPU: 1 UID: 0 PID: 6949 Comm: syz.0.335 Not tainted syzkaller #0 PREEMPT(full) > >>>>>>> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025 > >>>>>>> RIP: 0010:smc_diag_msg_common_fill net/smc/smc_diag.c:44 [inline] > >>>>>>> RIP: 0010:__smc_diag_dump.constprop.0+0x3ca/0x2550 net/smc/smc_diag.c:89 > >>>>>>> Call Trace: > >>>>>>> > >>>>>>> smc_diag_dump_proto+0x26d/0x420 net/smc/smc_diag.c:217 > >>>>>>> smc_diag_dump+0x27/0x90 net/smc/smc_diag.c:234 > >>>>>>> netlink_dump+0x539/0xd30 net/netlink/af_netlink.c:2327 > >>>>>>> __netlink_dump_start+0x6d6/0x990 net/netlink/af_netlink.c:2442 > >>>>>>> netlink_dump_start include/linux/netlink.h:341 [inline] > >>>>>>> smc_diag_handler_dump+0x1f9/0x240 net/smc/smc_diag.c:251 > >>>>>>> __sock_diag_cmd net/core/sock_diag.c:249 [inline] > >>>>>>> sock_diag_rcv_msg+0x438/0x790 net/core/sock_diag.c:285 > >>>>>>> netlink_rcv_skb+0x158/0x420 net/netlink/af_netlink.c:2552 > >>>>>>> netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline] > >>>>>>> netlink_unicast+0x5a7/0x870 net/netlink/af_netlink.c:1346 > >>>>>>> netlink_sendmsg+0x8d1/0xdd0 net/netlink/af_netlink.c:1896 > >>>>>>> sock_sendmsg_nosec net/socket.c:714 [inline] > >>>>>>> __sock_sendmsg net/socket.c:729 [inline] > >>>>>>> ____sys_sendmsg+0xa95/0xc70 net/socket.c:2614 > >>>>>>> ___sys_sendmsg+0x134/0x1d0 net/socket.c:2668 > >>>>>>> __sys_sendmsg+0x16d/0x220 net/socket.c:2700 > >>>>>>> do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] > >>>>>>> do_syscall_64+0xcd/0x4e0 arch/x86/entry/syscall_64.c:94 > >>>>>>> entry_SYSCALL_64_after_hwframe+0x77/0x7f > >>>>>>> > >>>>>>> > >>>>>>>The process like this: > >>>>>>> > >>>>>>> (CPU1) | (CPU2) > >>>>>>> ---------------------------------|------------------------------- > >>>>>>> inet_create() | > >>>>>>> // init clcsock to NULL | > >>>>>>> sk = sk_alloc() | > >>>>>>> | > >>>>>>> // unexpectedly change clcsock | > >>>>>>> inet_init_csk_locks() | > >>>>>>> | > >>>>>>> // add sk to hash table | > >>>>>>> smc_inet_init_sock() | > >>>>>>> smc_sk_init() | > >>>>>>> smc_hash_sk() | > >>>>>>> | // traverse the hash table > >>>>>>> | smc_diag_dump_proto > >>>>>>> | __smc_diag_dump() > >>>>>>> | // visit wrong clcsock > >>>>>>> | smc_diag_msg_common_fill() > >>>>>>> // alloc clcsock | > >>>>>>> smc_create_clcsk | > >>>>>>> sock_create_kern | > >>>>>>> > >>>>>>>With CONFIG_DEBUG_LOCK_ALLOC=y, the smc->clcsock is unexpectedly changed > >>>>>>>in inet_init_csk_locks(), because the struct smc_sock does not have struct > >>>>>>>inet_connection_sock as the first member. > >>>>>>> > >>>>>>>Previous commit 60ada4fe644e ("smc: Fix various oops due to inet_sock type > >>>>>>>confusion.") add inet_sock as the first member of smc_sock. For protocol > >>>>>>>with INET_PROTOSW_ICSK, use inet_connection_sock instead of inet_sock is > >>>>>>>more appropriate. > >>>>>Why is INET_PROTOSW_ICSK necessary in the first place ? > >>>>> > >>>>>I don't see a clear reason because smc_clcsock_accept() allocates > >>>>>a new sock by smc_sock_alloc() and does not use inet_accept(). > >>>>> > >>>>>Or is there any other path where smc_sock is cast to > >>>>>inet_connection_sock ? > >>>>What I saw in this code was a missing protection. > >>>> > >>>>smc_diag_msg_common_fill() runs without socket lock being held. > >>>> > >>>>I was thinking of this fix, but apparently syzbot still got crashes. > >>>Looking at the test result, > >>> > >>>https://syzkaller.appspot.com/x/report.txt?x=15944c7c580000 > >>>KASAN: maybe wild-memory-access in range [0xdead4ead00000018-0xdead4ead0000001f] > >>> > >>>the top half of the address is SPINLOCK_MAGIC (0xdead4ead), > >>>so the type confusion mentioned in the commit message makes > >>>sense to me. > >>> > >>>$ pahole -C inet_connection_sock vmlinux > >>>struct inet_connection_sock { > >>>... > >>> struct request_sock_queue icsk_accept_queue; /* 992 80 */ > >>> > >>>$ pahole -C smc_sock vmlinux > >>>struct smc_sock { > >>>... > >>> struct socket * clcsock; /* 992 8 */ > >>> > >>>The option is 1) let inet_init_csk_locks() init inet_connection_sock > >>>or 2) avoid inet_init_csk_locks(), and I guess 2) could be better to > >>>avoid potential issues in IS_ICSK branches. > >>> > >>I definitely vote to remove INET_PROTOSW_ICSK from smc. > >> > >>We want to reserve inet_connection_sock to TCP only, so that we can > >>move fields to better > >>cache friendly locations in tcp_sock hopefully for linux-6.19 > >Fully agreed. > > > >Wang: please squash the revert of 6fd27ea183c2 for > >INET_PROTOSW_ICSK removal. This is for one of > >IS_ICSK branches. > > > Thanks for your suggestions, they are helpful! > > I will remove INET_PROTOSW_ICSK from smc_inet_protosw and smc_inet6_protosw, > This is a bit of a long story. The INET_PROTOSW_ICSK flag was originally introduced for an effort to merge smc_sock and clcsock. The goal was to allow the merged socket to behave like a standard tcp_sock during fallback, thus avoiding the need for any special handling. However, this approach was later abandoned. Since the original reason for this flag no longer exists, so the removal makes sense. > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id QItvKQxS1mjGkxMAYBR5ng (envelope-from ) for ; Fri, 26 Sep 2025 08:42:52 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Fri, 26 Sep 2025 08:42:52 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v242V-00000005pb9-3fi4 for hi@josie.lol; Fri, 26 Sep 2025 08:42:52 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 1AFA11C216D6 for ; Fri, 26 Sep 2025 08:43:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EDD98295DBD; Fri, 26 Sep 2025 08:42:44 +0000 (UTC) X-Original-To: linux-s390@vger.kernel.org Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (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 40A1C35950; Fri, 26 Sep 2025 08:42:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758876164; cv=none; b=DExztVPYivMWQYOenkgfL4YHk57qRyfJp8RGiZZ+QiTQLODURC9D1f2Vka1Fs80mj4mM1MVSZXWSvolJyNYm9IsEQtKv49JUfxNnZ0qaKmCKaFoLM4MoAzQ1ImEzcDjQAwPcotJ+2LYORw+fzgKImyBPpihjjd+Em4Bsi6qiACo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758876164; c=relaxed/simple; bh=YpkXVO2Y6uKbqfDq/4Hn+poYOhVaKbGk1KU87swjoOQ=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=mAD8hU6pbgw7hSbSvjvaUiO8sUOX+IjMxDq0tNV3nHyZYEm1OWRilFom8hgiOXv8C5wNoD+Xxfu7yR5c4AhnA1SoC/c3rVAa4AixrZviBM+cytH7nb26gKX7jX1wKvnW6U9L8lTo3GXTTT3jv9oSbeF7XucnXy//xkW6c4Z2+zg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4cY3r74l2NzRkDx; Fri, 26 Sep 2025 16:37:59 +0800 (CST) Received: from dggpemf500016.china.huawei.com (unknown [7.185.36.197]) by mail.maildlp.com (Postfix) with ESMTPS id 755C6180486; Fri, 26 Sep 2025 16:42:38 +0800 (CST) Received: from [10.174.177.19] (10.174.177.19) by dggpemf500016.china.huawei.com (7.185.36.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 26 Sep 2025 16:42:36 +0800 Message-ID: <8ab4d343-d287-4b42-94f7-511f46e131d3@huawei.com> Date: Fri, 26 Sep 2025 16:42:35 +0800 Precedence: bulk X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net] net/smc: fix general protection fault in __smc_diag_dump To: Kuniyuki Iwashima , Eric Dumazet CC: , , , , , , , , , , , , , , , , References: <20250922121818.654011-1-wangliang74@huawei.com> From: Wang Liang In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: kwepems200002.china.huawei.com (7.221.188.68) To dggpemf500016.china.huawei.com (7.185.36.197) X-Spam-Score: 0.5 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: syzkaller.appspot.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.80.249 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.80.249 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.80.249 listed in bl.score.senderscore.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 5 在 2025/9/26 3:51, Kuniyuki Iwashima 写道: > On Thu, Sep 25, 2025 at 12:37 PM Eric Dumazet wrote: >> On Thu, Sep 25, 2025 at 12:25 PM Kuniyuki Iwashima wrote: >>> On Thu, Sep 25, 2025 at 11:54 AM Eric Dumazet wrote: >>>> On Thu, Sep 25, 2025 at 11:46 AM Kuniyuki Iwashima wrote: >>>>> Thanks Eric for CCing me. >>>>> >>>>> On Thu, Sep 25, 2025 at 7:32 AM Eric Dumazet wrote: >>>>>> On Mon, Sep 22, 2025 at 4:57 AM Wang Liang wrote: >>>>>>> The syzbot report a crash: >>>>>>> >>>>>>> Oops: general protection fault, probably for non-canonical address 0xfbd5a5d5a0000003: 0000 [#1] SMP KASAN NOPTI >>>>>>> KASAN: maybe wild-memory-access in range [0xdead4ead00000018-0xdead4ead0000001f] >>>>>>> CPU: 1 UID: 0 PID: 6949 Comm: syz.0.335 Not tainted syzkaller #0 PREEMPT(full) >>>>>>> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025 >>>>>>> RIP: 0010:smc_diag_msg_common_fill net/smc/smc_diag.c:44 [inline] >>>>>>> RIP: 0010:__smc_diag_dump.constprop.0+0x3ca/0x2550 net/smc/smc_diag.c:89 >>>>>>> Call Trace: >>>>>>> >>>>>>> smc_diag_dump_proto+0x26d/0x420 net/smc/smc_diag.c:217 >>>>>>> smc_diag_dump+0x27/0x90 net/smc/smc_diag.c:234 >>>>>>> netlink_dump+0x539/0xd30 net/netlink/af_netlink.c:2327 >>>>>>> __netlink_dump_start+0x6d6/0x990 net/netlink/af_netlink.c:2442 >>>>>>> netlink_dump_start include/linux/netlink.h:341 [inline] >>>>>>> smc_diag_handler_dump+0x1f9/0x240 net/smc/smc_diag.c:251 >>>>>>> __sock_diag_cmd net/core/sock_diag.c:249 [inline] >>>>>>> sock_diag_rcv_msg+0x438/0x790 net/core/sock_diag.c:285 >>>>>>> netlink_rcv_skb+0x158/0x420 net/netlink/af_netlink.c:2552 >>>>>>> netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline] >>>>>>> netlink_unicast+0x5a7/0x870 net/netlink/af_netlink.c:1346 >>>>>>> netlink_sendmsg+0x8d1/0xdd0 net/netlink/af_netlink.c:1896 >>>>>>> sock_sendmsg_nosec net/socket.c:714 [inline] >>>>>>> __sock_sendmsg net/socket.c:729 [inline] >>>>>>> ____sys_sendmsg+0xa95/0xc70 net/socket.c:2614 >>>>>>> ___sys_sendmsg+0x134/0x1d0 net/socket.c:2668 >>>>>>> __sys_sendmsg+0x16d/0x220 net/socket.c:2700 >>>>>>> do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] >>>>>>> do_syscall_64+0xcd/0x4e0 arch/x86/entry/syscall_64.c:94 >>>>>>> entry_SYSCALL_64_after_hwframe+0x77/0x7f >>>>>>> >>>>>>> >>>>>>> The process like this: >>>>>>> >>>>>>> (CPU1) | (CPU2) >>>>>>> ---------------------------------|------------------------------- >>>>>>> inet_create() | >>>>>>> // init clcsock to NULL | >>>>>>> sk = sk_alloc() | >>>>>>> | >>>>>>> // unexpectedly change clcsock | >>>>>>> inet_init_csk_locks() | >>>>>>> | >>>>>>> // add sk to hash table | >>>>>>> smc_inet_init_sock() | >>>>>>> smc_sk_init() | >>>>>>> smc_hash_sk() | >>>>>>> | // traverse the hash table >>>>>>> | smc_diag_dump_proto >>>>>>> | __smc_diag_dump() >>>>>>> | // visit wrong clcsock >>>>>>> | smc_diag_msg_common_fill() >>>>>>> // alloc clcsock | >>>>>>> smc_create_clcsk | >>>>>>> sock_create_kern | >>>>>>> >>>>>>> With CONFIG_DEBUG_LOCK_ALLOC=y, the smc->clcsock is unexpectedly changed >>>>>>> in inet_init_csk_locks(), because the struct smc_sock does not have struct >>>>>>> inet_connection_sock as the first member. >>>>>>> >>>>>>> Previous commit 60ada4fe644e ("smc: Fix various oops due to inet_sock type >>>>>>> confusion.") add inet_sock as the first member of smc_sock. For protocol >>>>>>> with INET_PROTOSW_ICSK, use inet_connection_sock instead of inet_sock is >>>>>>> more appropriate. >>>>> Why is INET_PROTOSW_ICSK necessary in the first place ? >>>>> >>>>> I don't see a clear reason because smc_clcsock_accept() allocates >>>>> a new sock by smc_sock_alloc() and does not use inet_accept(). >>>>> >>>>> Or is there any other path where smc_sock is cast to >>>>> inet_connection_sock ? >>>> What I saw in this code was a missing protection. >>>> >>>> smc_diag_msg_common_fill() runs without socket lock being held. >>>> >>>> I was thinking of this fix, but apparently syzbot still got crashes. >>> Looking at the test result, >>> >>> https://syzkaller.appspot.com/x/report.txt?x=15944c7c580000 >>> KASAN: maybe wild-memory-access in range [0xdead4ead00000018-0xdead4ead0000001f] >>> >>> the top half of the address is SPINLOCK_MAGIC (0xdead4ead), >>> so the type confusion mentioned in the commit message makes >>> sense to me. >>> >>> $ pahole -C inet_connection_sock vmlinux >>> struct inet_connection_sock { >>> ... >>> struct request_sock_queue icsk_accept_queue; /* 992 80 */ >>> >>> $ pahole -C smc_sock vmlinux >>> struct smc_sock { >>> ... >>> struct socket * clcsock; /* 992 8 */ >>> >>> The option is 1) let inet_init_csk_locks() init inet_connection_sock >>> or 2) avoid inet_init_csk_locks(), and I guess 2) could be better to >>> avoid potential issues in IS_ICSK branches. >>> >> I definitely vote to remove INET_PROTOSW_ICSK from smc. >> >> We want to reserve inet_connection_sock to TCP only, so that we can >> move fields to better >> cache friendly locations in tcp_sock hopefully for linux-6.19 > Fully agreed. > > Wang: please squash the revert of 6fd27ea183c2 for > INET_PROTOSW_ICSK removal. This is for one of > IS_ICSK branches. Thanks for your suggestions, they are helpful! I will remove INET_PROTOSW_ICSK from smc_inet_protosw and smc_inet6_protosw, and revert 6fd27ea183c2 ("net/smc: fix lacks of icsk_syn_mss with IPPROTO_SMC") in one patchset later. ------ Best regards Wang Liang From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id ILl4K1yd1WiV6jgAYBR5ng (envelope-from ) for ; Thu, 25 Sep 2025 19:51:56 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Thu, 25 Sep 2025 19:51:56 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v1s0S-0000000FuV9-0xjB for hi@josie.lol; Thu, 25 Sep 2025 19:51:56 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 813671B254AA for ; Thu, 25 Sep 2025 19:52:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CCE5031D75F; Thu, 25 Sep 2025 19:51:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="bu5IOrYA" X-Original-To: linux-s390@vger.kernel.org Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3030E31D74E for ; Thu, 25 Sep 2025 19:51:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758829910; cv=none; b=pVtcnxhK6fbyqzPxijVTrc//Gcc5rE7TVQ5Ig371rgoV9peJQbua8Qp+aoB3hoEmFv+tp54gaIX+4h1FVQhmDJPALIBkT4ritqkGvX8gGT2jM7c51+mmVRA1BCOoCgoaeibVW+0NIbf2n8ECKNWXCHMBBY/VOzT5SzWAa8SQZDs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758829910; c=relaxed/simple; bh=pDmPi+nDsdkh16sS4XOo0WoQjsIHhChrThGhNMoNGts=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=s0hDuDPw/vjpIr/hTqz102o1+9oRI5I11i2vh7kCCVDY2BgKPl43cUiQTYR/JkNiYruuNRaxJ8VwZGOCZOaQsrdaCr/O40+g6u7R17YTpGTzdMV6ghWQqkmWB1CF5Mzm6D+AurK5N4vGmA6YpOQMwVWxuKgi7Aaj7dAxOS/hdfo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=bu5IOrYA; arc=none smtp.client-ip=209.85.215.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-b49c1c130c9so983684a12.0 for ; Thu, 25 Sep 2025 12:51:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1758829908; x=1759434708; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=rv55ZBu/vAaRJGHC+Hl6bbjlGFEjsrTGV6fFQSN2diA=; b=bu5IOrYAfwwd0gBoEQuyrx6KpejnDrdlGyJJU4POKe9xTdOXiJo6QSqSnAQF+15WA5 0cFnwVO5cf+/svgZjt7f1Iz9WIURZ+eoZOmqOQO5k+cGS2OvGvCnmqVdpQ7hdeTqKnvo uihS8GkDh6bZIg5AxHgBpqPKThopmENjNc0x414jMD+mI/0jy+DT53xKdw3BLKlEP3d0 iV2hf60X0k8yR2KtNDXXOYR+npWGsr81VKEW+rgAAN/SsE6jYo9ZEoTZ2nkLNqEP582H /P/bjG3MHGguN4Q2s0JCLg70azje9+G2eV2yw0Dr2JnIx/Bsf3Ws86ZaXOyxLCT+ovU+ 0Pdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758829908; x=1759434708; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rv55ZBu/vAaRJGHC+Hl6bbjlGFEjsrTGV6fFQSN2diA=; b=KFS9kkpO51ruDoo4x6ZZTgvM9s8mQ1+qorU9aW6o1VOGC4guydpD6DsPTO7ht/5L1b BLcDgpUJACfsnTObAWg6gFm2jN3RvG8eI3+rYBxYGFKVHmyBjpE5PsHM00ELZEAoBkHi pvlPS1SO4xS58ATaZPdnlY/MIAcC9uc0GTl9P1Jp47IdrEpMDK359CHe05ybBi7Q7lHB vkcJrPi+kGwBb8AjvpJyqy1tNNx+gsfnr7Y81PtZCfFCLRjWtI4lT6wjFKNzx5xxDWEx Xiyi6+NKutqGkndWEnuxvnRhpaZY5rKtAbqv88kHSLvRJPV3zxb93j0is5KqWyqNIfLX kDKA== X-Forwarded-Encrypted: i=1; AJvYcCWTUxC/BetxLpllUJPLgXBFuPwv9n1GTu9+rXrsW9wabqFMKYTQ1vDKconarniOI/LEbLOICtzhZqGN@vger.kernel.org X-Gm-Message-State: AOJu0Yw6G3o5QzS9ovAxUv3z00hV1rqKxa6zRSXVyR6WofsWs8RDXmP0 R5S6g6XXv3I3xkB+qlnh9BJjQPo3VQXpkq+Y/Scc0j+QZ6ORMigKSsBadaPwlCDoPRjkB9nPlTE IltSru9VI8P/UqKM5FTFVg6Ad+5P+oh2aoFJaAfxiqu5jNZYdwBK5r0G1Nak= X-Gm-Gg: ASbGncu3bdfQGlLDhcDsMW9hYuoW8q5Xg16VafMYktKUqexOPQfQEJnf3zuKhab2paS KanaK5sKy/HB88vGejK4d3UGz0kRRebz5pq2zEnil+LuupcXJfx975z22KpE56jMelv5wfijLbP k5i68zqs6x0YamNsjzOmjHZP+JaWPeOJSj3tvYenPLMOV8Mk2diO4tvgCDWxbwZw9KhDqC1syUC Cp/rqUhI7h/20T/XqGLSjL46DLgHNLTWc12uImLm2lUffg= X-Google-Smtp-Source: AGHT+IEMxPfUQjoBcfANKqp9Vkg+WQJ3eu9qIHeIMZROEVNo7FCgnZHJoaajMVV6jRvi1vvmnFYYvC7eSgqUM5vPToY= X-Received: by 2002:a17:903:3d0e:b0:271:5bde:697e with SMTP id d9443c01a7336-27ed49b9e58mr48033525ad.3.1758829908255; Thu, 25 Sep 2025 12:51:48 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20250922121818.654011-1-wangliang74@huawei.com> In-Reply-To: From: Kuniyuki Iwashima Date: Thu, 25 Sep 2025 12:51:37 -0700 X-Gm-Features: AS18NWAA2SBIe4o1ksv9NLao6qJzvr8CVNGLCgq5DU2m2sX7IFSITs6B-eWQNdo Message-ID: Subject: Re: [PATCH net] net/smc: fix general protection fault in __smc_diag_dump To: Eric Dumazet , Wang Liang Cc: alibuda@linux.alibaba.com, dust.li@linux.alibaba.com, sidraya@linux.ibm.com, wenjia@linux.ibm.com, mjambigi@linux.ibm.com, tonylu@linux.alibaba.com, guwen@linux.alibaba.com, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, yuehaibing@huawei.com, zhangchangzhong@huawei.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-DKIM: signer='google.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -7.1 (-------) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-7.1 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: syzkaller.appspot.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.80.249 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.80.249 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.80.249 listed in sa-accredit.habeas.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM welcome-list -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_MED DKIMwl.org - Medium trust sender SpamTally: Final spam score: -70 On Thu, Sep 25, 2025 at 12:37=E2=80=AFPM Eric Dumazet = wrote: > > On Thu, Sep 25, 2025 at 12:25=E2=80=AFPM Kuniyuki Iwashima wrote: > > > > On Thu, Sep 25, 2025 at 11:54=E2=80=AFAM Eric Dumazet wrote: > > > > > > On Thu, Sep 25, 2025 at 11:46=E2=80=AFAM Kuniyuki Iwashima wrote: > > > > > > > > Thanks Eric for CCing me. > > > > > > > > On Thu, Sep 25, 2025 at 7:32=E2=80=AFAM Eric Dumazet wrote: > > > > > > > > > > On Mon, Sep 22, 2025 at 4:57=E2=80=AFAM Wang Liang wrote: > > > > > > > > > > > > The syzbot report a crash: > > > > > > > > > > > > Oops: general protection fault, probably for non-canonical ad= dress 0xfbd5a5d5a0000003: 0000 [#1] SMP KASAN NOPTI > > > > > > KASAN: maybe wild-memory-access in range [0xdead4ead00000018-= 0xdead4ead0000001f] > > > > > > CPU: 1 UID: 0 PID: 6949 Comm: syz.0.335 Not tainted syzkaller= #0 PREEMPT(full) > > > > > > Hardware name: Google Google Compute Engine/Google Compute En= gine, BIOS Google 08/18/2025 > > > > > > RIP: 0010:smc_diag_msg_common_fill net/smc/smc_diag.c:44 [inl= ine] > > > > > > RIP: 0010:__smc_diag_dump.constprop.0+0x3ca/0x2550 net/smc/sm= c_diag.c:89 > > > > > > Call Trace: > > > > > > > > > > > > smc_diag_dump_proto+0x26d/0x420 net/smc/smc_diag.c:217 > > > > > > smc_diag_dump+0x27/0x90 net/smc/smc_diag.c:234 > > > > > > netlink_dump+0x539/0xd30 net/netlink/af_netlink.c:2327 > > > > > > __netlink_dump_start+0x6d6/0x990 net/netlink/af_netlink.c:24= 42 > > > > > > netlink_dump_start include/linux/netlink.h:341 [inline] > > > > > > smc_diag_handler_dump+0x1f9/0x240 net/smc/smc_diag.c:251 > > > > > > __sock_diag_cmd net/core/sock_diag.c:249 [inline] > > > > > > sock_diag_rcv_msg+0x438/0x790 net/core/sock_diag.c:285 > > > > > > netlink_rcv_skb+0x158/0x420 net/netlink/af_netlink.c:2552 > > > > > > netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline= ] > > > > > > netlink_unicast+0x5a7/0x870 net/netlink/af_netlink.c:1346 > > > > > > netlink_sendmsg+0x8d1/0xdd0 net/netlink/af_netlink.c:1896 > > > > > > sock_sendmsg_nosec net/socket.c:714 [inline] > > > > > > __sock_sendmsg net/socket.c:729 [inline] > > > > > > ____sys_sendmsg+0xa95/0xc70 net/socket.c:2614 > > > > > > ___sys_sendmsg+0x134/0x1d0 net/socket.c:2668 > > > > > > __sys_sendmsg+0x16d/0x220 net/socket.c:2700 > > > > > > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] > > > > > > do_syscall_64+0xcd/0x4e0 arch/x86/entry/syscall_64.c:94 > > > > > > entry_SYSCALL_64_after_hwframe+0x77/0x7f > > > > > > > > > > > > > > > > > > The process like this: > > > > > > > > > > > > (CPU1) | (CPU2) > > > > > > ---------------------------------|---------------------------= ---- > > > > > > inet_create() | > > > > > > // init clcsock to NULL | > > > > > > sk =3D sk_alloc() | > > > > > > | > > > > > > // unexpectedly change clcsock | > > > > > > inet_init_csk_locks() | > > > > > > | > > > > > > // add sk to hash table | > > > > > > smc_inet_init_sock() | > > > > > > smc_sk_init() | > > > > > > smc_hash_sk() | > > > > > > | // traverse the hash table > > > > > > | smc_diag_dump_proto > > > > > > | __smc_diag_dump() > > > > > > | // visit wrong clcsock > > > > > > | smc_diag_msg_common_fi= ll() > > > > > > // alloc clcsock | > > > > > > smc_create_clcsk | > > > > > > sock_create_kern | > > > > > > > > > > > > With CONFIG_DEBUG_LOCK_ALLOC=3Dy, the smc->clcsock is unexpecte= dly changed > > > > > > in inet_init_csk_locks(), because the struct smc_sock does not = have struct > > > > > > inet_connection_sock as the first member. > > > > > > > > > > > > Previous commit 60ada4fe644e ("smc: Fix various oops due to ine= t_sock type > > > > > > confusion.") add inet_sock as the first member of smc_sock. For= protocol > > > > > > with INET_PROTOSW_ICSK, use inet_connection_sock instead of ine= t_sock is > > > > > > more appropriate. > > > > > > > > Why is INET_PROTOSW_ICSK necessary in the first place ? > > > > > > > > I don't see a clear reason because smc_clcsock_accept() allocates > > > > a new sock by smc_sock_alloc() and does not use inet_accept(). > > > > > > > > Or is there any other path where smc_sock is cast to > > > > inet_connection_sock ? > > > > > > What I saw in this code was a missing protection. > > > > > > smc_diag_msg_common_fill() runs without socket lock being held. > > > > > > I was thinking of this fix, but apparently syzbot still got crashes. > > > > Looking at the test result, > > > > https://syzkaller.appspot.com/x/report.txt?x=3D15944c7c580000 > > KASAN: maybe wild-memory-access in range [0xdead4ead00000018-0xdead4ead= 0000001f] > > > > the top half of the address is SPINLOCK_MAGIC (0xdead4ead), > > so the type confusion mentioned in the commit message makes > > sense to me. > > > > $ pahole -C inet_connection_sock vmlinux > > struct inet_connection_sock { > > ... > > struct request_sock_queue icsk_accept_queue; /* 992 80 */ > > > > $ pahole -C smc_sock vmlinux > > struct smc_sock { > > ... > > struct socket * clcsock; /* 992 8 */ > > > > The option is 1) let inet_init_csk_locks() init inet_connection_sock > > or 2) avoid inet_init_csk_locks(), and I guess 2) could be better to > > avoid potential issues in IS_ICSK branches. > > > > I definitely vote to remove INET_PROTOSW_ICSK from smc. > > We want to reserve inet_connection_sock to TCP only, so that we can > move fields to better > cache friendly locations in tcp_sock hopefully for linux-6.19 Fully agreed. Wang: please squash the revert of 6fd27ea183c2 for INET_PROTOSW_ICSK removal. This is for one of IS_ICSK branches. From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id kIMiOBia1WimGDgAYBR5ng (envelope-from ) for ; Thu, 25 Sep 2025 19:38:00 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Thu, 25 Sep 2025 19:38:00 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v1rmy-0000000FSGP-2DLR for hi@josie.lol; Thu, 25 Sep 2025 19:38:00 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B3AAA3A87CD for ; Thu, 25 Sep 2025 19:37:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A2CE431C583; Thu, 25 Sep 2025 19:37:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="WBE5GJGa" X-Original-To: linux-s390@vger.kernel.org Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D31DB31A57C for ; Thu, 25 Sep 2025 19:37:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758829074; cv=none; b=peFTfxLr6wB1pvuklfnPrR1ZGiAPZxNIsctioX5xefEnikToQkvjKwLzXIgHZ8MREYOzccoopw8ab4LPGcTpikVUTR8zFm4dHjgWX9XurdsEjWTHLbedvIOzAQn0O7DTR5EWxgof9kog3/+jjXlRRGIEUMq8WOpYuUjDgFer/4Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758829074; c=relaxed/simple; bh=70ZBbyiWkxW1T3x7VR16vWSCd+9K6UpnTlnQYJI5UQc=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=fHkDsLQEk12/zNMWFS3LfSOXQNH2wuXJq6H117Mv6n1LzG/VLFuATHWJd5kzWgLPXTJO7D2T67BvLKg+E0aYKK/mpN9TL+0amx+QUagseJ12v+8ZVLDdm7lhKyaWYMUwtjLzRKRSkbHVkx7IzKepFXg3q0RQRKtmME/d5O9YaD8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=WBE5GJGa; arc=none smtp.client-ip=209.85.160.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-qt1-f178.google.com with SMTP id d75a77b69052e-4da7a3d0402so14569251cf.0 for ; Thu, 25 Sep 2025 12:37:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1758829072; x=1759433872; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=q2Q1cBc7LUQcu2cuJvD0/M3cFaWYJRZZW0Vz5p9Kpw4=; b=WBE5GJGabaGdSmJTtatnyD1dkpodYYc5bB4En6SBvgvbuMThHiMI5cFbDPevjR1jRe EZl8D8ABDN1ooeL1I5kAG+dSuxUOj2w4MTzZjoyRHrx/blw14Rs4l058LAbqnekIfxxI 1Z+7T5iHy07XGGDodbru/RekFPuvIp0fxZ3pJfcEIpRnTq+JBnBd84aFv7WMNs/wuE0r cJnPcrjoRlCOvCdGWtcmeXIC2m76Wzxm3X0KNHcPegyiS1QAoFDRIIarwEvR4WdrKAK1 QHYZMjwcI4G8WXe5A5SkUPw8YMhhPrWP/1uVWSpMRT5ZQ+d11GqfUrlX/ww8OOzEcHKP 7hbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758829072; x=1759433872; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q2Q1cBc7LUQcu2cuJvD0/M3cFaWYJRZZW0Vz5p9Kpw4=; b=Veh8DZpt3Vj1CgBbFVp8y2ncz8g9o/zCGxvqXwLy8vKjlSGG4VBlrVJ1hnalfayln1 qx5OJ3q/QWw6HEdImGP8JT15XxDDJGJIg/N4rguAldmRUC0OVXZ11QGQJzfnyUN7EvT+ /9qM7ULi9MboryAv+5OhJM8YGd/MPVv+uaix10FBWGXjOcFYUxNk9xyVVVaRHnl/W67s KVCy5/PXg4bGm2sV6fEgSoHrS7y1ChPj0pualSslkA5DR/0mYKUkfgpl4wZm6YIyBDXw GPJT8QC0eW9IRMcc97T6FXz5LrjsdZ8/qCFfj+fW0IU7iugQW8DwKvyAjEB+tiYQgaXz Jr0Q== X-Forwarded-Encrypted: i=1; AJvYcCU245QvJrSErFTZUyPqQO/wYxT36tOMRLDkzmG2NCJWTD/DHHpYCYBVU33BEK3AYEh96MwsqOAFc2rU@vger.kernel.org X-Gm-Message-State: AOJu0YxiigFDXVWlGdGlBPnM1dNucb21jpP8RKxcZHN1i5F6ych8vPqF H/eTy3TykGqa7bB3ITZ4K0Q5zxJKfvdaK58fkM1bfXx1mcqg/3ranugJJtyMp5+oZGs5H83uHBC 99H47K+Bq2zGUE0ZnTLzJ49YkuSsVZvn1sG9BVoPV X-Gm-Gg: ASbGncvjev/0aeVgUSC8dm5bV9FCXuf70eSyCYNUbPxBXuY7W1qlczZscBtyCwoBxU9 OhsAQk3gUh1j09+LLDZUv5dCDDt6t45q8DZMsdMATduQo2rtdalF6f+b/Y3a/HhBlAf1sgY5Sp4 lA16jDmQ0S03fU69+eKuqzBWNMixHZ4/qSTjDEPXdfobOViNSTf3/Ts9RdeVxLoWqIBufM2NDDZ MNrh23+ekjbqGD2ZGB7CHqk X-Google-Smtp-Source: AGHT+IHCvRuGt6NFVvOMpJCv91jV7RoFz9Wa0ZhVESXQsSNw9YJ/r7CF3agmA+c897IDwvF/1apFe92TOHo1/cNcVes= X-Received: by 2002:a05:622a:4b:b0:4b0:6a6c:c8cf with SMTP id d75a77b69052e-4daca1f78f0mr45166161cf.15.1758829071156; Thu, 25 Sep 2025 12:37:51 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20250922121818.654011-1-wangliang74@huawei.com> In-Reply-To: From: Eric Dumazet Date: Thu, 25 Sep 2025 12:37:39 -0700 X-Gm-Features: AS18NWBfb_5R9ookN-KFp8lqhGE_84Rt920qCX1G3bgXwF8E_8TZGmU8sJIuKgo Message-ID: Subject: Re: [PATCH net] net/smc: fix general protection fault in __smc_diag_dump To: Kuniyuki Iwashima Cc: Wang Liang , alibuda@linux.alibaba.com, dust.li@linux.alibaba.com, sidraya@linux.ibm.com, wenjia@linux.ibm.com, mjambigi@linux.ibm.com, tonylu@linux.alibaba.com, guwen@linux.alibaba.com, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, yuehaibing@huawei.com, zhangchangzhong@huawei.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-DKIM: signer='google.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -7.1 (-------) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-7.1 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.178.88.99 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.178.88.99 listed in sa-accredit.habeas.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM welcome-list -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: syzkaller.appspot.com] -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_MED DKIMwl.org - Medium trust sender SpamTally: Final spam score: -70 On Thu, Sep 25, 2025 at 12:25=E2=80=AFPM Kuniyuki Iwashima wrote: > > On Thu, Sep 25, 2025 at 11:54=E2=80=AFAM Eric Dumazet wrote: > > > > On Thu, Sep 25, 2025 at 11:46=E2=80=AFAM Kuniyuki Iwashima wrote: > > > > > > Thanks Eric for CCing me. > > > > > > On Thu, Sep 25, 2025 at 7:32=E2=80=AFAM Eric Dumazet wrote: > > > > > > > > On Mon, Sep 22, 2025 at 4:57=E2=80=AFAM Wang Liang wrote: > > > > > > > > > > The syzbot report a crash: > > > > > > > > > > Oops: general protection fault, probably for non-canonical addr= ess 0xfbd5a5d5a0000003: 0000 [#1] SMP KASAN NOPTI > > > > > KASAN: maybe wild-memory-access in range [0xdead4ead00000018-0x= dead4ead0000001f] > > > > > CPU: 1 UID: 0 PID: 6949 Comm: syz.0.335 Not tainted syzkaller #= 0 PREEMPT(full) > > > > > Hardware name: Google Google Compute Engine/Google Compute Engi= ne, BIOS Google 08/18/2025 > > > > > RIP: 0010:smc_diag_msg_common_fill net/smc/smc_diag.c:44 [inlin= e] > > > > > RIP: 0010:__smc_diag_dump.constprop.0+0x3ca/0x2550 net/smc/smc_= diag.c:89 > > > > > Call Trace: > > > > > > > > > > smc_diag_dump_proto+0x26d/0x420 net/smc/smc_diag.c:217 > > > > > smc_diag_dump+0x27/0x90 net/smc/smc_diag.c:234 > > > > > netlink_dump+0x539/0xd30 net/netlink/af_netlink.c:2327 > > > > > __netlink_dump_start+0x6d6/0x990 net/netlink/af_netlink.c:2442 > > > > > netlink_dump_start include/linux/netlink.h:341 [inline] > > > > > smc_diag_handler_dump+0x1f9/0x240 net/smc/smc_diag.c:251 > > > > > __sock_diag_cmd net/core/sock_diag.c:249 [inline] > > > > > sock_diag_rcv_msg+0x438/0x790 net/core/sock_diag.c:285 > > > > > netlink_rcv_skb+0x158/0x420 net/netlink/af_netlink.c:2552 > > > > > netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline] > > > > > netlink_unicast+0x5a7/0x870 net/netlink/af_netlink.c:1346 > > > > > netlink_sendmsg+0x8d1/0xdd0 net/netlink/af_netlink.c:1896 > > > > > sock_sendmsg_nosec net/socket.c:714 [inline] > > > > > __sock_sendmsg net/socket.c:729 [inline] > > > > > ____sys_sendmsg+0xa95/0xc70 net/socket.c:2614 > > > > > ___sys_sendmsg+0x134/0x1d0 net/socket.c:2668 > > > > > __sys_sendmsg+0x16d/0x220 net/socket.c:2700 > > > > > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] > > > > > do_syscall_64+0xcd/0x4e0 arch/x86/entry/syscall_64.c:94 > > > > > entry_SYSCALL_64_after_hwframe+0x77/0x7f > > > > > > > > > > > > > > > The process like this: > > > > > > > > > > (CPU1) | (CPU2) > > > > > ---------------------------------|-----------------------------= -- > > > > > inet_create() | > > > > > // init clcsock to NULL | > > > > > sk =3D sk_alloc() | > > > > > | > > > > > // unexpectedly change clcsock | > > > > > inet_init_csk_locks() | > > > > > | > > > > > // add sk to hash table | > > > > > smc_inet_init_sock() | > > > > > smc_sk_init() | > > > > > smc_hash_sk() | > > > > > | // traverse the hash table > > > > > | smc_diag_dump_proto > > > > > | __smc_diag_dump() > > > > > | // visit wrong clcsock > > > > > | smc_diag_msg_common_fill= () > > > > > // alloc clcsock | > > > > > smc_create_clcsk | > > > > > sock_create_kern | > > > > > > > > > > With CONFIG_DEBUG_LOCK_ALLOC=3Dy, the smc->clcsock is unexpectedl= y changed > > > > > in inet_init_csk_locks(), because the struct smc_sock does not ha= ve struct > > > > > inet_connection_sock as the first member. > > > > > > > > > > Previous commit 60ada4fe644e ("smc: Fix various oops due to inet_= sock type > > > > > confusion.") add inet_sock as the first member of smc_sock. For p= rotocol > > > > > with INET_PROTOSW_ICSK, use inet_connection_sock instead of inet_= sock is > > > > > more appropriate. > > > > > > Why is INET_PROTOSW_ICSK necessary in the first place ? > > > > > > I don't see a clear reason because smc_clcsock_accept() allocates > > > a new sock by smc_sock_alloc() and does not use inet_accept(). > > > > > > Or is there any other path where smc_sock is cast to > > > inet_connection_sock ? > > > > What I saw in this code was a missing protection. > > > > smc_diag_msg_common_fill() runs without socket lock being held. > > > > I was thinking of this fix, but apparently syzbot still got crashes. > > Looking at the test result, > > https://syzkaller.appspot.com/x/report.txt?x=3D15944c7c580000 > KASAN: maybe wild-memory-access in range [0xdead4ead00000018-0xdead4ead00= 00001f] > > the top half of the address is SPINLOCK_MAGIC (0xdead4ead), > so the type confusion mentioned in the commit message makes > sense to me. > > $ pahole -C inet_connection_sock vmlinux > struct inet_connection_sock { > ... > struct request_sock_queue icsk_accept_queue; /* 992 80 */ > > $ pahole -C smc_sock vmlinux > struct smc_sock { > ... > struct socket * clcsock; /* 992 8 */ > > The option is 1) let inet_init_csk_locks() init inet_connection_sock > or 2) avoid inet_init_csk_locks(), and I guess 2) could be better to > avoid potential issues in IS_ICSK branches. > I definitely vote to remove INET_PROTOSW_ICSK from smc. We want to reserve inet_connection_sock to TCP only, so that we can move fields to better cache friendly locations in tcp_sock hopefully for linux-6.19 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id gKnwF2WX1WgDWy4AYBR5ng (envelope-from ) for ; Thu, 25 Sep 2025 19:26:29 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Thu, 25 Sep 2025 19:26:29 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v1rbo-0000000F5qf-3jMH for hi@josie.lol; Thu, 25 Sep 2025 19:26:29 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2CCBA4C65DE for ; Thu, 25 Sep 2025 19:26:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B08031BCAA; Thu, 25 Sep 2025 19:26:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="UWmbrlOf" X-Original-To: linux-s390@vger.kernel.org Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 34FE331B829 for ; Thu, 25 Sep 2025 19:25:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758828359; cv=none; b=CfCSxPbuzWLxhY7OCHUyjC4xNy1xRjKcXnsPMQWruh562i3bgBFPQthNeoiKPMrFEwOhkFDnpaU/fHlKAOno9Od6eeV1WCcf6PwTbqvbp5bCyXCJKyMstUPK9yHXXcqy+QiaR3IdaEhbBF9rHvUxvLFLEjKVK5QopSf9c/ekSWs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758828359; c=relaxed/simple; bh=+LGzKQfkIxBfEL7uanfWaTQi2NIBi71cSv2KDGt8AIk=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=eworCxm4MaSBbV8mOOL8WxYk8l5Du9iIYs0Q9Bi03z0NC3aWD++tw2EQhsbMMfyaGY4eB5gC4RVopOFp78ZqGSTltDA0cGue3SIGIPMS6PiWzW8tflCDlo7VIDaf2aEZCqYeQdgD4zg1Ck1yX3+DOYdxz8fyrbu2CSEUgrivXR4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=UWmbrlOf; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-24457f581aeso14446075ad.0 for ; Thu, 25 Sep 2025 12:25:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1758828357; x=1759433157; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Uxxej+A54UMxIPTRKqDdkxTeyPEcpC6j3CvIRkzYnRY=; b=UWmbrlOf8AJ3oZ57H4WtpjsxQfI97awRzHw4rFJvujcOQijcyP7Kw0+BGhtyrlauPd NwXgtpoP/1iG9zc62tWa7APAHubwIH/FE67aMJCxfZN/Ge4c7+bOrMB9xE6kn6GORHoQ KoHvMvZ0WKG4FKQ+C0hgOQ4IAHjPxJLkpQByyyFZudQT6hMo+5LQlKTnGx8976PrEtLT JASIsep/mjqqzDHsxlVq0X6aP20D7Lj3Gi2RMc7HMycbdPjmkwr38vvFqlJzrrmFZrWc OW69y9QwvlRLb4eJZorgcBRQcBADJQshKpntxNtUwO/JgIhozu63+pQhPUpRPgINbpRp olvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758828357; x=1759433157; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Uxxej+A54UMxIPTRKqDdkxTeyPEcpC6j3CvIRkzYnRY=; b=lfGH8DZI1dFxBZryfjSg/LcwkhdpC7D6N3pCYSeywUTTiYtHyBAR2UlMaouIXOZ0a+ nV/0JaIMEVYBgY6TYxF5ZiBqRqlq5TB5L8fXR25CVQRwbq9LtV83gzvOIxsa4T6Y4Xb9 n1JF+fGVKwIvliZce4jPuGEVa9gQh1x3GyaIvPyw9cn12FCwAxeqIT4ZwCyXXfGsaeCt /mzx6NLVAJyHUKo4N28kK1tUZKL2W+jsaVoC1u38cAL6lvM8/XelO4uv1MjEFAb1n59W 1KtFfyycZpPc8yl9Z225dFXv0k7wIpP9eBLooklXHIBGRdVTXDqw2ut6vGa/Daamp9eP CEZQ== X-Forwarded-Encrypted: i=1; AJvYcCW3eate3boGNpi3uJ2mC3jIZvQ7+rYWGlEB5GIRcOS+HtcGj5E6OSH7yKgDv+OByMWj6Aamy5TVb7dY@vger.kernel.org X-Gm-Message-State: AOJu0YzOfA5dCrQPoPIpkflU+Xp+A+5pktTzrt5kcO3SqqE0XuciWDvM 1M5qZOLmVYE3X9/W7H+gLWAcdXYgMWH6De9dGfNnwk32ZGKjqir3cxDH1ILetosJLSOAJCODXjP uHQdo/Lk2tATMb4IG75EW0esE4pOwZp+kHwQ3qL2H X-Gm-Gg: ASbGncsGqGL2PMSBWHElEEdR/h9/wS5XHJQlcA8XPWHq4Glo3fUaKI9qVwLhmB2ufXt nceIzDxJcCZZYVIJp0jiE9AiuVj6mhYo17xnnEJpJjnH52xivvLaiuC0CYqc6mu2E8+mXGvOAT4 SR6DWOWucyTgTCc9Ii6brg3+XABlZ3gVCvOCIg+jIIyIs7VJ1i7dgmzTvuCqtzFY8MllRFl/4k0 G26V7zxF0uTULt0KeSM1azrNQYHX/i1OVDSvZoozNtX5gA= X-Google-Smtp-Source: AGHT+IFqxRshKGBvHaiDtYARmbc57qR195V71ZCUISbd+cEP9B0APoeNbfdgU15orpP/Wf293P73psfog6W4tFlVzHY= X-Received: by 2002:a17:903:a8b:b0:27d:339c:4b0 with SMTP id d9443c01a7336-27ed4aa57f1mr1907665ad.35.1758828357289; Thu, 25 Sep 2025 12:25:57 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20250922121818.654011-1-wangliang74@huawei.com> In-Reply-To: From: Kuniyuki Iwashima Date: Thu, 25 Sep 2025 12:25:46 -0700 X-Gm-Features: AS18NWBzBs30Kpj0VoFjpDJLTRb2ZjM8uVopnfW0zH1RkFfGm4UpJjsXE_5WI18 Message-ID: Subject: Re: [PATCH net] net/smc: fix general protection fault in __smc_diag_dump To: Eric Dumazet Cc: Wang Liang , alibuda@linux.alibaba.com, dust.li@linux.alibaba.com, sidraya@linux.ibm.com, wenjia@linux.ibm.com, mjambigi@linux.ibm.com, tonylu@linux.alibaba.com, guwen@linux.alibaba.com, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, yuehaibing@huawei.com, zhangchangzhong@huawei.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-DKIM: signer='google.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -9.4 (---------) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-9.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: syzkaller.appspot.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.178.88.99 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.178.88.99 listed in sa-trusted.bondedsender.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM welcome-list -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [139.178.88.99 listed in list.dnswl.org] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_MED DKIMwl.org - Medium trust sender SpamTally: Final spam score: -93 On Thu, Sep 25, 2025 at 11:54=E2=80=AFAM Eric Dumazet = wrote: > > On Thu, Sep 25, 2025 at 11:46=E2=80=AFAM Kuniyuki Iwashima wrote: > > > > Thanks Eric for CCing me. > > > > On Thu, Sep 25, 2025 at 7:32=E2=80=AFAM Eric Dumazet wrote: > > > > > > On Mon, Sep 22, 2025 at 4:57=E2=80=AFAM Wang Liang wrote: > > > > > > > > The syzbot report a crash: > > > > > > > > Oops: general protection fault, probably for non-canonical addres= s 0xfbd5a5d5a0000003: 0000 [#1] SMP KASAN NOPTI > > > > KASAN: maybe wild-memory-access in range [0xdead4ead00000018-0xde= ad4ead0000001f] > > > > CPU: 1 UID: 0 PID: 6949 Comm: syz.0.335 Not tainted syzkaller #0 = PREEMPT(full) > > > > Hardware name: Google Google Compute Engine/Google Compute Engine= , BIOS Google 08/18/2025 > > > > RIP: 0010:smc_diag_msg_common_fill net/smc/smc_diag.c:44 [inline] > > > > RIP: 0010:__smc_diag_dump.constprop.0+0x3ca/0x2550 net/smc/smc_di= ag.c:89 > > > > Call Trace: > > > > > > > > smc_diag_dump_proto+0x26d/0x420 net/smc/smc_diag.c:217 > > > > smc_diag_dump+0x27/0x90 net/smc/smc_diag.c:234 > > > > netlink_dump+0x539/0xd30 net/netlink/af_netlink.c:2327 > > > > __netlink_dump_start+0x6d6/0x990 net/netlink/af_netlink.c:2442 > > > > netlink_dump_start include/linux/netlink.h:341 [inline] > > > > smc_diag_handler_dump+0x1f9/0x240 net/smc/smc_diag.c:251 > > > > __sock_diag_cmd net/core/sock_diag.c:249 [inline] > > > > sock_diag_rcv_msg+0x438/0x790 net/core/sock_diag.c:285 > > > > netlink_rcv_skb+0x158/0x420 net/netlink/af_netlink.c:2552 > > > > netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline] > > > > netlink_unicast+0x5a7/0x870 net/netlink/af_netlink.c:1346 > > > > netlink_sendmsg+0x8d1/0xdd0 net/netlink/af_netlink.c:1896 > > > > sock_sendmsg_nosec net/socket.c:714 [inline] > > > > __sock_sendmsg net/socket.c:729 [inline] > > > > ____sys_sendmsg+0xa95/0xc70 net/socket.c:2614 > > > > ___sys_sendmsg+0x134/0x1d0 net/socket.c:2668 > > > > __sys_sendmsg+0x16d/0x220 net/socket.c:2700 > > > > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] > > > > do_syscall_64+0xcd/0x4e0 arch/x86/entry/syscall_64.c:94 > > > > entry_SYSCALL_64_after_hwframe+0x77/0x7f > > > > > > > > > > > > The process like this: > > > > > > > > (CPU1) | (CPU2) > > > > ---------------------------------|------------------------------- > > > > inet_create() | > > > > // init clcsock to NULL | > > > > sk =3D sk_alloc() | > > > > | > > > > // unexpectedly change clcsock | > > > > inet_init_csk_locks() | > > > > | > > > > // add sk to hash table | > > > > smc_inet_init_sock() | > > > > smc_sk_init() | > > > > smc_hash_sk() | > > > > | // traverse the hash table > > > > | smc_diag_dump_proto > > > > | __smc_diag_dump() > > > > | // visit wrong clcsock > > > > | smc_diag_msg_common_fill() > > > > // alloc clcsock | > > > > smc_create_clcsk | > > > > sock_create_kern | > > > > > > > > With CONFIG_DEBUG_LOCK_ALLOC=3Dy, the smc->clcsock is unexpectedly = changed > > > > in inet_init_csk_locks(), because the struct smc_sock does not have= struct > > > > inet_connection_sock as the first member. > > > > > > > > Previous commit 60ada4fe644e ("smc: Fix various oops due to inet_so= ck type > > > > confusion.") add inet_sock as the first member of smc_sock. For pro= tocol > > > > with INET_PROTOSW_ICSK, use inet_connection_sock instead of inet_so= ck is > > > > more appropriate. > > > > Why is INET_PROTOSW_ICSK necessary in the first place ? > > > > I don't see a clear reason because smc_clcsock_accept() allocates > > a new sock by smc_sock_alloc() and does not use inet_accept(). > > > > Or is there any other path where smc_sock is cast to > > inet_connection_sock ? > > What I saw in this code was a missing protection. > > smc_diag_msg_common_fill() runs without socket lock being held. > > I was thinking of this fix, but apparently syzbot still got crashes. Looking at the test result, https://syzkaller.appspot.com/x/report.txt?x=3D15944c7c580000 KASAN: maybe wild-memory-access in range [0xdead4ead00000018-0xdead4ead0000= 001f] the top half of the address is SPINLOCK_MAGIC (0xdead4ead), so the type confusion mentioned in the commit message makes sense to me. $ pahole -C inet_connection_sock vmlinux struct inet_connection_sock { ... struct request_sock_queue icsk_accept_queue; /* 992 80 */ $ pahole -C smc_sock vmlinux struct smc_sock { ... struct socket * clcsock; /* 992 8 */ The option is 1) let inet_init_csk_locks() init inet_connection_sock or 2) avoid inet_init_csk_locks(), and I guess 2) could be better to avoid potential issues in IS_ICSK branches. > > diff --git a/net/smc/smc_close.c b/net/smc/smc_close.c > index 10219f55aad14d795dabe4331458bd1b73c22789..b6abd0efea22c0c9726090b5d= e60e648b86e09a0 > 100644 > --- a/net/smc/smc_close.c > +++ b/net/smc/smc_close.c > @@ -30,7 +30,8 @@ void smc_clcsock_release(struct smc_sock *smc) > mutex_lock(&smc->clcsock_release_lock); > if (smc->clcsock) { > tcp =3D smc->clcsock; > - smc->clcsock =3D NULL; > + WRITE_ONCE(smc->clcsock, NULL); > + synchronize_rcu(); > sock_release(tcp); > } > mutex_unlock(&smc->clcsock_release_lock); > diff --git a/net/smc/smc_diag.c b/net/smc/smc_diag.c > index bf0beaa23bdb63edfe0c37515aa17a04bb648c08..069607c1db9aff76d1d4f23b4= 7dfeb5177c433d8 > 100644 > --- a/net/smc/smc_diag.c > +++ b/net/smc/smc_diag.c > @@ -35,26 +35,32 @@ static struct smc_diag_dump_ctx > *smc_dump_context(struct netlink_callback *cb) > static void smc_diag_msg_common_fill(struct smc_diag_msg *r, struct sock= *sk) > { > struct smc_sock *smc =3D smc_sk(sk); > + struct socket *clcsock; > > memset(r, 0, sizeof(*r)); > r->diag_family =3D sk->sk_family; > sock_diag_save_cookie(sk, r->id.idiag_cookie); > - if (!smc->clcsock) > - return; > - r->id.idiag_sport =3D htons(smc->clcsock->sk->sk_num); > - r->id.idiag_dport =3D smc->clcsock->sk->sk_dport; > - r->id.idiag_if =3D smc->clcsock->sk->sk_bound_dev_if; > + > + rcu_read_lock(); > + clcsock =3D READ_ONCE(smc->clcsock); > + if (!clcsock) > + goto unlock; > + r->id.idiag_sport =3D htons(clcsock->sk->sk_num); > + r->id.idiag_dport =3D clcsock->sk->sk_dport; > + r->id.idiag_if =3D clcsock->sk->sk_bound_dev_if; > if (sk->sk_protocol =3D=3D SMCPROTO_SMC) { > - r->id.idiag_src[0] =3D smc->clcsock->sk->sk_rcv_saddr; > - r->id.idiag_dst[0] =3D smc->clcsock->sk->sk_daddr; > + r->id.idiag_src[0] =3D clcsock->sk->sk_rcv_saddr; > + r->id.idiag_dst[0] =3D clcsock->sk->sk_daddr; > #if IS_ENABLED(CONFIG_IPV6) > } else if (sk->sk_protocol =3D=3D SMCPROTO_SMC6) { > - memcpy(&r->id.idiag_src, &smc->clcsock->sk->sk_v6_rcv_sad= dr, > - sizeof(smc->clcsock->sk->sk_v6_rcv_saddr)); > - memcpy(&r->id.idiag_dst, &smc->clcsock->sk->sk_v6_daddr, > - sizeof(smc->clcsock->sk->sk_v6_daddr)); > + memcpy(&r->id.idiag_src, &clcsock->sk->sk_v6_rcv_saddr, > + sizeof(clcsock->sk->sk_v6_rcv_saddr)); > + memcpy(&r->id.idiag_dst, &clcsock->sk->sk_v6_daddr, > + sizeof(clcsock->sk->sk_v6_daddr)); > #endif > } > +unlock: > + rcu_read_unlock(); > } From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id oKROHNaP1Whz/y4AYBR5ng (envelope-from ) for ; Thu, 25 Sep 2025 18:54:14 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Thu, 25 Sep 2025 18:54:14 +0000 Received: from ny.mirrors.kernel.org ([147.75.199.223]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v1r6c-0000000DyzV-0ZAa for hi@josie.lol; Thu, 25 Sep 2025 18:54:14 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3297D4A2E36 for ; Thu, 25 Sep 2025 18:54:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E574331A56B; Thu, 25 Sep 2025 18:54:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="eczDmY82" X-Original-To: linux-s390@vger.kernel.org Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1690E3148CD for ; Thu, 25 Sep 2025 18:54:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758826451; cv=none; b=SRpnrqY7tCbEUmV4NHeb0BCIzqb15qpF9D9OhREZUpM+BeN3KXhRlMeHnVSfUeoOT314PGG3c6bubjPq9yFNirtRfOiBeuItTi8V3kx7LaxGjcts7tcAPhA8aI9tvEtk6nQSkZ9O8ysqYBtbnqy+byen+6XpOn9ocxiRe0azqyk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758826451; c=relaxed/simple; bh=Yp1u8iALz7sgABTMbwglWX907cvWMrc8RZudxNFkNQ0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=WpLxn/b13yoTuizISeChQGEsgOn3lmUIz6aKDuhcadI8LK2wL8UTXF1/Kgi6Kk0JHLpcGXu2UaXxn5kqTSO7HrwDEoLeI1U4e5qn5zRj8dq1WxgCC9rkpPxQwYCCHxCenaJvBj6DSTGWZY/zesSltIgqQdeDn1daGGWd2YrtMlQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=eczDmY82; arc=none smtp.client-ip=209.85.222.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-qk1-f171.google.com with SMTP id af79cd13be357-8572d7b2457so118816985a.1 for ; Thu, 25 Sep 2025 11:54:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1758826449; x=1759431249; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=C79BnGNdqfA1WFmZDdOgQ1u/4DfiWGTxrbsuXwmR4Dw=; b=eczDmY82r6aPM8ryIxz2/2b7Mt6Q3mBH3xaE5TUuOHYv9r6WCbVF6Iq0ESaPZrk+N0 tencNw1VNrgBoQCGScdhw4i/+XczYBcetleUoY0AtBL8c0geNPxNaaBlgs7yz+LfLjCa 6E/F4eQ57ygJfqJ4Rro/QS86ouqYJ5MrcEejEZozZf+2zksjBC7bSqfVboiG0UTevZfj KJ518fT1c5R0PaqakVl2oTmdq3MC9d+/Czl77fdUGKnHwFQ5BiQ2TtHUHoyJeUKHa7Zf GR99I9vWSH7kx2ihL1aaChylgUJHLEhoZ+9AzgkhlGsV/opbvD37IZZkiK1eKNaPSPsf spxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758826449; x=1759431249; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C79BnGNdqfA1WFmZDdOgQ1u/4DfiWGTxrbsuXwmR4Dw=; b=Zx9Lq5yR6/bFkiCETlG5x3iA0GlRChZvCDC9FCtHh+iTtbJqTH7+pn/jI9IUhM9/L3 JFDA+9kBsQ2YZV+a/mqIuDi8ThqQOy53QWbLl5Y2ZGCn/l2FUtwl9diUBwgBlbVB48EI 6S9dsdUcjaY2knmo4/UoncspuZ3u0kTDKtqiA3VtJjYmm+yTQJ0GAsvKhcqZjypE8MPH wlFx7O5oyS1KK/j7ZaFogFfqLv2g6cKXXxAzYWNSt1rBY+1Ok+pK7gmH1/EZARi4du46 g9FEeBNsGdjHTIzOTE7GRQp1HdAZfooUJ0dhwOkmo3n49HRru2QDdkwy0ns2azhBh9Tf Gxuw== X-Forwarded-Encrypted: i=1; AJvYcCXkMNq2HnIN5ihYl/PHJNhJX9d15RFKr5tHpkuC+SF7qVbVUiYxNBL/OGObyUbj+BxxpJJYdHn98D5Q@vger.kernel.org X-Gm-Message-State: AOJu0YykgTSyqnJTyvHo6OJJamzgZnYrm2AK92bKO+O91zVEPySFanAB k0eJgIPDhljuvn1mZvVf57cUikO1H2oG6uOOTkT4HZHrutwbJfY1L6fcQmaIZKcZ8QfbCGWcy0J yg57qQLEmbXcAx58TXfL857qDyZrMbf/KUQiNr+Cs X-Gm-Gg: ASbGncvaQuUx4+FRj1l8Qqecx9dLsJ5M3Kg8nLAdXY5a8qrh4I66FHluJbXP4G6Dbl1 FQpe5HRM5KwM34/K05ddyZ6utOFVTTgA/F94Km1BP6m3fNaVLKHSimhdszt5zAdfqtohQu+UXc+ I4wmOFDtFlYgtk9SO8FoseqJ6PR0YzHYc0W07zUQOC856q6diEpIYknK5LFjBkUpwkgLRqJrWhY F1MFNYluHv34CMxgaZBRu9o X-Google-Smtp-Source: AGHT+IH1X6h5C3xlWpGoKkj10vK3Dwz9ecUbJIlaxhcqy2DB4Z5TSfe9YirXsmbh2jkAFRB2d2osgAI0nwWKORuft7I= X-Received: by 2002:a05:620a:711b:b0:852:b230:220e with SMTP id af79cd13be357-85bc193e658mr434859985a.2.1758826448329; Thu, 25 Sep 2025 11:54:08 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20250922121818.654011-1-wangliang74@huawei.com> In-Reply-To: From: Eric Dumazet Date: Thu, 25 Sep 2025 11:53:56 -0700 X-Gm-Features: AS18NWBwxub5p7eNitiTZnu8uGg9aM-Gp-udVPszRrM6yAsoUpaHXcy8NJ6T7JI Message-ID: Subject: Re: [PATCH net] net/smc: fix general protection fault in __smc_diag_dump To: Kuniyuki Iwashima Cc: Wang Liang , alibuda@linux.alibaba.com, dust.li@linux.alibaba.com, sidraya@linux.ibm.com, wenjia@linux.ibm.com, mjambigi@linux.ibm.com, tonylu@linux.alibaba.com, guwen@linux.alibaba.com, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, yuehaibing@huawei.com, zhangchangzhong@huawei.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-DKIM: signer='google.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -7.1 (-------) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-7.1 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.199.223 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.199.223 listed in sa-trusted.bondedsender.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM welcome-list 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.199.223 listed in list.dnswl.org] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_MED DKIMwl.org - Medium trust sender SpamTally: Final spam score: -70 On Thu, Sep 25, 2025 at 11:46=E2=80=AFAM Kuniyuki Iwashima wrote: > > Thanks Eric for CCing me. > > On Thu, Sep 25, 2025 at 7:32=E2=80=AFAM Eric Dumazet wrote: > > > > On Mon, Sep 22, 2025 at 4:57=E2=80=AFAM Wang Liang wrote: > > > > > > The syzbot report a crash: > > > > > > Oops: general protection fault, probably for non-canonical address = 0xfbd5a5d5a0000003: 0000 [#1] SMP KASAN NOPTI > > > KASAN: maybe wild-memory-access in range [0xdead4ead00000018-0xdead= 4ead0000001f] > > > CPU: 1 UID: 0 PID: 6949 Comm: syz.0.335 Not tainted syzkaller #0 PR= EEMPT(full) > > > Hardware name: Google Google Compute Engine/Google Compute Engine, = BIOS Google 08/18/2025 > > > RIP: 0010:smc_diag_msg_common_fill net/smc/smc_diag.c:44 [inline] > > > RIP: 0010:__smc_diag_dump.constprop.0+0x3ca/0x2550 net/smc/smc_diag= .c:89 > > > Call Trace: > > > > > > smc_diag_dump_proto+0x26d/0x420 net/smc/smc_diag.c:217 > > > smc_diag_dump+0x27/0x90 net/smc/smc_diag.c:234 > > > netlink_dump+0x539/0xd30 net/netlink/af_netlink.c:2327 > > > __netlink_dump_start+0x6d6/0x990 net/netlink/af_netlink.c:2442 > > > netlink_dump_start include/linux/netlink.h:341 [inline] > > > smc_diag_handler_dump+0x1f9/0x240 net/smc/smc_diag.c:251 > > > __sock_diag_cmd net/core/sock_diag.c:249 [inline] > > > sock_diag_rcv_msg+0x438/0x790 net/core/sock_diag.c:285 > > > netlink_rcv_skb+0x158/0x420 net/netlink/af_netlink.c:2552 > > > netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline] > > > netlink_unicast+0x5a7/0x870 net/netlink/af_netlink.c:1346 > > > netlink_sendmsg+0x8d1/0xdd0 net/netlink/af_netlink.c:1896 > > > sock_sendmsg_nosec net/socket.c:714 [inline] > > > __sock_sendmsg net/socket.c:729 [inline] > > > ____sys_sendmsg+0xa95/0xc70 net/socket.c:2614 > > > ___sys_sendmsg+0x134/0x1d0 net/socket.c:2668 > > > __sys_sendmsg+0x16d/0x220 net/socket.c:2700 > > > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] > > > do_syscall_64+0xcd/0x4e0 arch/x86/entry/syscall_64.c:94 > > > entry_SYSCALL_64_after_hwframe+0x77/0x7f > > > > > > > > > The process like this: > > > > > > (CPU1) | (CPU2) > > > ---------------------------------|------------------------------- > > > inet_create() | > > > // init clcsock to NULL | > > > sk =3D sk_alloc() | > > > | > > > // unexpectedly change clcsock | > > > inet_init_csk_locks() | > > > | > > > // add sk to hash table | > > > smc_inet_init_sock() | > > > smc_sk_init() | > > > smc_hash_sk() | > > > | // traverse the hash table > > > | smc_diag_dump_proto > > > | __smc_diag_dump() > > > | // visit wrong clcsock > > > | smc_diag_msg_common_fill() > > > // alloc clcsock | > > > smc_create_clcsk | > > > sock_create_kern | > > > > > > With CONFIG_DEBUG_LOCK_ALLOC=3Dy, the smc->clcsock is unexpectedly ch= anged > > > in inet_init_csk_locks(), because the struct smc_sock does not have s= truct > > > inet_connection_sock as the first member. > > > > > > Previous commit 60ada4fe644e ("smc: Fix various oops due to inet_sock= type > > > confusion.") add inet_sock as the first member of smc_sock. For proto= col > > > with INET_PROTOSW_ICSK, use inet_connection_sock instead of inet_sock= is > > > more appropriate. > > Why is INET_PROTOSW_ICSK necessary in the first place ? > > I don't see a clear reason because smc_clcsock_accept() allocates > a new sock by smc_sock_alloc() and does not use inet_accept(). > > Or is there any other path where smc_sock is cast to > inet_connection_sock ? What I saw in this code was a missing protection. smc_diag_msg_common_fill() runs without socket lock being held. I was thinking of this fix, but apparently syzbot still got crashes. diff --git a/net/smc/smc_close.c b/net/smc/smc_close.c index 10219f55aad14d795dabe4331458bd1b73c22789..b6abd0efea22c0c9726090b5de6= 0e648b86e09a0 100644 --- a/net/smc/smc_close.c +++ b/net/smc/smc_close.c @@ -30,7 +30,8 @@ void smc_clcsock_release(struct smc_sock *smc) mutex_lock(&smc->clcsock_release_lock); if (smc->clcsock) { tcp =3D smc->clcsock; - smc->clcsock =3D NULL; + WRITE_ONCE(smc->clcsock, NULL); + synchronize_rcu(); sock_release(tcp); } mutex_unlock(&smc->clcsock_release_lock); diff --git a/net/smc/smc_diag.c b/net/smc/smc_diag.c index bf0beaa23bdb63edfe0c37515aa17a04bb648c08..069607c1db9aff76d1d4f23b47d= feb5177c433d8 100644 --- a/net/smc/smc_diag.c +++ b/net/smc/smc_diag.c @@ -35,26 +35,32 @@ static struct smc_diag_dump_ctx *smc_dump_context(struct netlink_callback *cb) static void smc_diag_msg_common_fill(struct smc_diag_msg *r, struct sock *= sk) { struct smc_sock *smc =3D smc_sk(sk); + struct socket *clcsock; memset(r, 0, sizeof(*r)); r->diag_family =3D sk->sk_family; sock_diag_save_cookie(sk, r->id.idiag_cookie); - if (!smc->clcsock) - return; - r->id.idiag_sport =3D htons(smc->clcsock->sk->sk_num); - r->id.idiag_dport =3D smc->clcsock->sk->sk_dport; - r->id.idiag_if =3D smc->clcsock->sk->sk_bound_dev_if; + + rcu_read_lock(); + clcsock =3D READ_ONCE(smc->clcsock); + if (!clcsock) + goto unlock; + r->id.idiag_sport =3D htons(clcsock->sk->sk_num); + r->id.idiag_dport =3D clcsock->sk->sk_dport; + r->id.idiag_if =3D clcsock->sk->sk_bound_dev_if; if (sk->sk_protocol =3D=3D SMCPROTO_SMC) { - r->id.idiag_src[0] =3D smc->clcsock->sk->sk_rcv_saddr; - r->id.idiag_dst[0] =3D smc->clcsock->sk->sk_daddr; + r->id.idiag_src[0] =3D clcsock->sk->sk_rcv_saddr; + r->id.idiag_dst[0] =3D clcsock->sk->sk_daddr; #if IS_ENABLED(CONFIG_IPV6) } else if (sk->sk_protocol =3D=3D SMCPROTO_SMC6) { - memcpy(&r->id.idiag_src, &smc->clcsock->sk->sk_v6_rcv_saddr= , - sizeof(smc->clcsock->sk->sk_v6_rcv_saddr)); - memcpy(&r->id.idiag_dst, &smc->clcsock->sk->sk_v6_daddr, - sizeof(smc->clcsock->sk->sk_v6_daddr)); + memcpy(&r->id.idiag_src, &clcsock->sk->sk_v6_rcv_saddr, + sizeof(clcsock->sk->sk_v6_rcv_saddr)); + memcpy(&r->id.idiag_dst, &clcsock->sk->sk_v6_daddr, + sizeof(clcsock->sk->sk_v6_daddr)); #endif } +unlock: + rcu_read_unlock(); } From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id SPrfGRmO1Wi9Ly4AYBR5ng (envelope-from ) for ; Thu, 25 Sep 2025 18:46:49 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Thu, 25 Sep 2025 18:46:49 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v1qzQ-0000000DjHL-3YFL for hi@josie.lol; Thu, 25 Sep 2025 18:46:49 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C9A923A6F10 for ; Thu, 25 Sep 2025 18:46:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9A9122E7BA0; Thu, 25 Sep 2025 18:46:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="VWN9sZeP" X-Original-To: linux-s390@vger.kernel.org Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC1AB2E1747 for ; Thu, 25 Sep 2025 18:46:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758826002; cv=none; b=L8YJdlTdoc/dNODGsTGGmvhlDX2KAq8LcoMSH7zr/lkzQhZCskJRjjq52GS4XSkFoxSyFyuOszicknl8GWmbfgD7EQHv5G/6BNkdWP7Vyj4WfHJbuvn+Qld8AjLgd3QIVr60JUfUrQ1uC74qPGzmhyRtvS79YyUqEOKGY3T1SAY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758826002; c=relaxed/simple; bh=lfgcz3m4LxsJc7fu9Gh6cquree6UlWdW+wi7FdecF+E=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=l8adXLvOIhQAPUdNSGX81/QfdyAdcnIz6Sh+3h7IsK9+NIgjMzmBpbhkfOrsP4nbiAxfqfg8UPeMKIiAXX27yWR+d/AVhOxt+7ApUUjEQ0sdMiYGFOWF9BE4ROCRraUgFSneNtbqjvvWOF0orcT8jczbrRscEm0elymmRj80o7o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=VWN9sZeP; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-27eceb38eb1so15341325ad.3 for ; Thu, 25 Sep 2025 11:46:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1758826000; x=1759430800; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=lLdUuxsUyFeLw5VmYATasRsILS+Z5g1sPWduMjqAJtQ=; b=VWN9sZePBfN8PboPgWPiYarkSaQayMFmyL4dwSRNIbNagtH0EkrrbtlQHgrePovVAE njAMWChJ5eh2jR25v9pMJkaW+hB8zhRMWNRxf2/QW5aHTjayVyrcI2NL0eZ+Tmp5B0sq DBC9YZV5sfFeNFtN4pUj3C4CZO+3A8CxftmQFglqCMrENpNZOpDHgGK6Ay3JLXiY2rfW YpL9CnssC6D1ukSvVTNmyt/BnNyL/plYCUhuFP19vx8HpiSHSMOORIHCF8gF+QSb/4in 5v3GPqIrd3/bdZG/b0/M8vTVk4Mkw3rNRPX59eZ6FLmqANaAjSR8iNSNVQxztCCWwQy2 aMqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758826000; x=1759430800; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lLdUuxsUyFeLw5VmYATasRsILS+Z5g1sPWduMjqAJtQ=; b=MycXG87Vgxe9j3Q2z+GhMwsXFbPXnBcAOE2+WI0pJAZlgRTIkqL1VxayXd9AfGX+6N pjjdGNkbP/gSzbvGY+WOhJW6TkjNaZfF2T+WLiMt6lad2iZsYTtPjcrgne5PYi1LqGCH T+y5Loe+5tgupfMRZZOe7EPWa3l718nvKsd9JySGL5Jrbv03ejUUiS//l95SgfPOUFHN HZwCNrz5wvjPpVLwsQuuXFsghQw96S1ZdSge8c9JzKBCdgC8ZlPqgutbT0aXk5deZlFv G/N8FpNAvyE6OPiyMPpu+9Pk490pN0eukScrFC+vDCJN0MoWiy/qWEQ7ZM91+5XXxkqG zDPg== X-Forwarded-Encrypted: i=1; AJvYcCUEzIGe3rn7CG/+C046NkZRNi/ddy0HKHVdCycPl+tEmixjP/k49YSo6BmC/feld+F/714+k4Leiucp@vger.kernel.org X-Gm-Message-State: AOJu0YzWFdh6eQqZNRK0GgNdjJGGsUXfOeo77aGJ2yElHw5HLCvz2rLy 9FvI8imW3hTxzSTTgYSzm19EusWVh7UnCB8cGCocgHdlV87S/JPqsp5IW3ZXZv83NLsn5WZEjTN a5K3gJdgpynvvfYrGXZFdps3RvFFdgaMISzprn8sk X-Gm-Gg: ASbGncseMBVevCQh7s+VQs4oy5wMQdO34P0j2s+ebUb2nsRPN9IvDZGyqC6JRcpL/bB kXol2/KBKcrQ6N799FwkMz3mfSCyrLRkT2TEhz5LZ10izR55vMpyrlB8JjGoh1MZjY+UgW/APrQ YA8hIhoIbGieDhaYTKiwSsY8v5WIlNQjpHOU83yZP+hDa6eKhtWZHdBu1+E3IndFU9KJWUehA5Z kZbgr1grQKi5meHeKS5MqayublnA/BPdKhWydLvzjMdRMc0X3sYTtC07A== X-Google-Smtp-Source: AGHT+IFHjpr/efSIGkSFc5aOwJwEJU/g3ib8aCrwbTfnR8LYDmx3PXaFp3wa4hoCDt63NVnjWqyIsHdEpL7XBgbkxZg= X-Received: by 2002:a17:902:d490:b0:277:71e6:b04d with SMTP id d9443c01a7336-27ed4a29e5dmr46669715ad.3.1758825999931; Thu, 25 Sep 2025 11:46:39 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20250922121818.654011-1-wangliang74@huawei.com> In-Reply-To: From: Kuniyuki Iwashima Date: Thu, 25 Sep 2025 11:46:28 -0700 X-Gm-Features: AS18NWCbS5gc66qTtEBpXFcEyjAbYBGY7oQ_xwB_xqs7eGxR4FmmvHj2dUmJMhQ Message-ID: Subject: Re: [PATCH net] net/smc: fix general protection fault in __smc_diag_dump To: Wang Liang Cc: Eric Dumazet , alibuda@linux.alibaba.com, dust.li@linux.alibaba.com, sidraya@linux.ibm.com, wenjia@linux.ibm.com, mjambigi@linux.ibm.com, tonylu@linux.alibaba.com, guwen@linux.alibaba.com, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, yuehaibing@huawei.com, zhangchangzhong@huawei.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-DKIM: signer='google.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -7.1 (-------) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-7.1 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.178.88.99 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.178.88.99 listed in bl.score.senderscore.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM welcome-list -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_MED DKIMwl.org - Medium trust sender SpamTally: Final spam score: -70 Thanks Eric for CCing me. On Thu, Sep 25, 2025 at 7:32=E2=80=AFAM Eric Dumazet = wrote: > > On Mon, Sep 22, 2025 at 4:57=E2=80=AFAM Wang Liang wrote: > > > > The syzbot report a crash: > > > > Oops: general protection fault, probably for non-canonical address 0x= fbd5a5d5a0000003: 0000 [#1] SMP KASAN NOPTI > > KASAN: maybe wild-memory-access in range [0xdead4ead00000018-0xdead4e= ad0000001f] > > CPU: 1 UID: 0 PID: 6949 Comm: syz.0.335 Not tainted syzkaller #0 PREE= MPT(full) > > Hardware name: Google Google Compute Engine/Google Compute Engine, BI= OS Google 08/18/2025 > > RIP: 0010:smc_diag_msg_common_fill net/smc/smc_diag.c:44 [inline] > > RIP: 0010:__smc_diag_dump.constprop.0+0x3ca/0x2550 net/smc/smc_diag.c= :89 > > Call Trace: > > > > smc_diag_dump_proto+0x26d/0x420 net/smc/smc_diag.c:217 > > smc_diag_dump+0x27/0x90 net/smc/smc_diag.c:234 > > netlink_dump+0x539/0xd30 net/netlink/af_netlink.c:2327 > > __netlink_dump_start+0x6d6/0x990 net/netlink/af_netlink.c:2442 > > netlink_dump_start include/linux/netlink.h:341 [inline] > > smc_diag_handler_dump+0x1f9/0x240 net/smc/smc_diag.c:251 > > __sock_diag_cmd net/core/sock_diag.c:249 [inline] > > sock_diag_rcv_msg+0x438/0x790 net/core/sock_diag.c:285 > > netlink_rcv_skb+0x158/0x420 net/netlink/af_netlink.c:2552 > > netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline] > > netlink_unicast+0x5a7/0x870 net/netlink/af_netlink.c:1346 > > netlink_sendmsg+0x8d1/0xdd0 net/netlink/af_netlink.c:1896 > > sock_sendmsg_nosec net/socket.c:714 [inline] > > __sock_sendmsg net/socket.c:729 [inline] > > ____sys_sendmsg+0xa95/0xc70 net/socket.c:2614 > > ___sys_sendmsg+0x134/0x1d0 net/socket.c:2668 > > __sys_sendmsg+0x16d/0x220 net/socket.c:2700 > > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] > > do_syscall_64+0xcd/0x4e0 arch/x86/entry/syscall_64.c:94 > > entry_SYSCALL_64_after_hwframe+0x77/0x7f > > > > > > The process like this: > > > > (CPU1) | (CPU2) > > ---------------------------------|------------------------------- > > inet_create() | > > // init clcsock to NULL | > > sk =3D sk_alloc() | > > | > > // unexpectedly change clcsock | > > inet_init_csk_locks() | > > | > > // add sk to hash table | > > smc_inet_init_sock() | > > smc_sk_init() | > > smc_hash_sk() | > > | // traverse the hash table > > | smc_diag_dump_proto > > | __smc_diag_dump() > > | // visit wrong clcsock > > | smc_diag_msg_common_fill() > > // alloc clcsock | > > smc_create_clcsk | > > sock_create_kern | > > > > With CONFIG_DEBUG_LOCK_ALLOC=3Dy, the smc->clcsock is unexpectedly chan= ged > > in inet_init_csk_locks(), because the struct smc_sock does not have str= uct > > inet_connection_sock as the first member. > > > > Previous commit 60ada4fe644e ("smc: Fix various oops due to inet_sock t= ype > > confusion.") add inet_sock as the first member of smc_sock. For protoco= l > > with INET_PROTOSW_ICSK, use inet_connection_sock instead of inet_sock i= s > > more appropriate. Why is INET_PROTOSW_ICSK necessary in the first place ? I don't see a clear reason because smc_clcsock_accept() allocates a new sock by smc_sock_alloc() and does not use inet_accept(). Or is there any other path where smc_sock is cast to inet_connection_sock ? > > > > Reported-by: syzbot+f775be4458668f7d220e@syzkaller.appspotmail.com > > Closes: https://syzkaller.appspot.com/bug?extid=3Df775be4458668f7d220e > > Tested-by: syzbot+f775be4458668f7d220e@syzkaller.appspotmail.com > > Fixes: d25a92ccae6b ("net/smc: Introduce IPPROTO_SMC") > > Signed-off-by: Wang Liang > > --- > > net/smc/smc.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/net/smc/smc.h b/net/smc/smc.h > > index 2c9084963739..1b20f0c927d3 100644 > > --- a/net/smc/smc.h > > +++ b/net/smc/smc.h > > @@ -285,7 +285,7 @@ struct smc_connection { > > struct smc_sock { /* smc sock container *= / > > union { > > struct sock sk; > > - struct inet_sock icsk_inet; > > + struct inet_connection_sock inet_conn; > > }; > > struct socket *clcsock; /* internal tcp socket = */ > > void (*clcsk_state_change)(struct sock *sk); > > -- > > 2.34.1 > > > > Kuniyuki, can you please review, I think you had a related fix recently. > > Thanks. > > commit 60ada4fe644edaa6c2da97364184b0425e8aeaf5 > Author: Kuniyuki Iwashima > Date: Fri Jul 11 06:07:52 2025 +0000 > > smc: Fix various oops due to inet_sock type confusion. From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id gNI6Dh5T1WhruA8AYBR5ng (envelope-from ) for ; Thu, 25 Sep 2025 14:35:10 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Thu, 25 Sep 2025 14:35:10 +0000 Received: from ny.mirrors.kernel.org ([147.75.199.223]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v1n3t-00000004q2P-42Sg for hi@josie.lol; Thu, 25 Sep 2025 14:35:10 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D3D532A5E04 for ; Thu, 25 Sep 2025 14:33:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AD2152D9EFF; Thu, 25 Sep 2025 14:32:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="oIgb/qKt" X-Original-To: linux-s390@vger.kernel.org Received: from mail-yw1-f175.google.com (mail-yw1-f175.google.com [209.85.128.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E661A2DA74A for ; Thu, 25 Sep 2025 14:32:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758810763; cv=none; b=Vlkab3cEAau05qClv8ZPYN1Ki682q9ecYyCRopCt8UJb1kLDQl0f1OtI6Ga7xASP74HligQvBuc5Rx/nWdPrazKXDybq+6g9Ggqjd6p9OLn7+lgvKH/bEyZJUdySv1OXQ0kSF1fvdorRtm7dCuKxZin2Ig4qsYLlytd2Uw41Q5Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758810763; c=relaxed/simple; bh=t2XhKDcOt+laEXJKI0ZnYMcUTY3NrTdNzuZY0B9gwa8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=pBrJmN2cbS8G/JdXoyrTCQai1TlYizB7HnzDJbYNQng887ZE05XJ/bR5xH+O7r67mO6mssqB4YJlhMuIAd9D6tUwr1NARJWS0abmeRGNYGi/4joB7gYwRVfGjLfq0SbZ9GKNV83KyOiqlE3Zisgu62Clrvq4tqZvXPOPaHdKwHs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=oIgb/qKt; arc=none smtp.client-ip=209.85.128.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-743ba48eb71so22615837b3.1 for ; Thu, 25 Sep 2025 07:32:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1758810760; x=1759415560; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Q3t/i7G6sNLKCulldNQHYLFlpc4dAP8McL+RwiXOYYM=; b=oIgb/qKtzNG20IudvQHkMdpg78J7mR5whHJN11kqRfTI7Rwxbdh4teDfCJIzTDthYV LqFWXDHfq7mV7JGPezZkmiaiNBnFlrhi1XQJ0Vgh4cBepdTR5MLworBtXkWPtxiIpeLg fCluQPVHGI8m+bj2omQif9xnbn3D5MWkcy3bKuqN2ZT0/Vwv6tSDsM5xElNVwlpJsfE2 oCwu+LwD7FaRaW3/sxTxvE+J9yLPuxMxArjHfJlFeys4AzuEKno1LMhOKHFvhkqegOQd Fhr2fNUcDG/pHRd2vvKzGxK0piUCf34UKHBekgbc4zjNGwQx7JSHDugFim2ZDaizPG03 CO1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758810760; x=1759415560; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q3t/i7G6sNLKCulldNQHYLFlpc4dAP8McL+RwiXOYYM=; b=u0q257V2iL2Gzckgtgr5sVx0d9bL/bp2fpzIzbJ5BtC5ES77hKMdA4PRFTkbELoNm4 kR8VhsTnTLJ2mvqPs/pOHeTgYKR6emLtSi7CnPdz3t54NChWnR5aUwF5NDZM0p6zjJum dTNgxz/oZj6V1p1RM1i4IevMZQGCQi2QHFjOjgcG0d/u8cXQRMCNj4R2MdwTge1Ba/o/ gWtscrZvkj0I5rcKzcebjcVR4Wb84d+JT/SbX1PdwcmfMePWCeQZ3qO6smYhFSvf2Xm8 Kqf5nfV9ISjGJ1F2aRfgNVs20RARIPZRWEl7mbfgxZWfo0V/w5vtmlZBL1OboBBRqDte mfWw== X-Forwarded-Encrypted: i=1; AJvYcCUGgC9XL8d53F5US6F/73gAS92cDHgdI3d2VX5UWFUMkqMV/M/siQrJCw5JXOYmmwQImFby7L0SsFNH@vger.kernel.org X-Gm-Message-State: AOJu0YwMGyiMTs8oP/lTRmUiKy8GKnl8+XyhmBv3zT2a5xA8OY9m9/EO UYxu6aV7ZQr7v/X487kbApxrcqDYZ2hk+0P0S7MP5zKjVK3ShBbalLZwcz3r8YS3HeHou6E2ZTR iFZg3z11UCr4YzWQ+MgsdjHqXsQza6XWViCc4e9hp X-Gm-Gg: ASbGnctFMEx//oQHhxCU7XMjlUTJHPYxyVKW9soepe9ZOPkZ8Yd9LpBtIFiM12PtXtx fcmQ0GvrCxKGdxI7Z173+pcZ8kJGhFlXEL/vbG5njDmKbO4V7c/jANo96kgHMLbsX74hn8Rpjua ZxTC3Ko2JkJeNEK0wgnBdOwffxqE0avGb54A1nEqJFS2wQ2PqtxKWyhB28ODxQt2i7Seba4mBu0 U9Mn1ILZXESKw== X-Google-Smtp-Source: AGHT+IGPVZb8260WIN2V5Is62i24gV4aTIwROuDhQPAORW+WvMp6xmIWUJzg3WDP3IAyIAjWSew/LKrgoflQZygG3no= X-Received: by 2002:a05:6902:1003:b0:ea5:b757:9641 with SMTP id 3f1490d57ef6-eb3853fca26mr1716135276.1.1758810759200; Thu, 25 Sep 2025 07:32:39 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20250922121818.654011-1-wangliang74@huawei.com> In-Reply-To: <20250922121818.654011-1-wangliang74@huawei.com> From: Eric Dumazet Date: Thu, 25 Sep 2025 07:32:27 -0700 X-Gm-Features: AS18NWC0x8CFQRjOZVU80gw3PZ5hWaNCl3XvXGEiSPqo83w7a1Av7fuCtK5U9es Message-ID: Subject: Re: [PATCH net] net/smc: fix general protection fault in __smc_diag_dump To: Wang Liang , Kuniyuki Iwashima Cc: alibuda@linux.alibaba.com, dust.li@linux.alibaba.com, sidraya@linux.ibm.com, wenjia@linux.ibm.com, mjambigi@linux.ibm.com, tonylu@linux.alibaba.com, guwen@linux.alibaba.com, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, yuehaibing@huawei.com, zhangchangzhong@huawei.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-DKIM: signer='google.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -7.1 (-------) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-7.1 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: syzkaller.appspot.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.199.223 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.199.223 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.199.223 listed in bl.score.senderscore.com] -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM welcome-list 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_MED DKIMwl.org - Medium trust sender SpamTally: Final spam score: -70 On Mon, Sep 22, 2025 at 4:57=E2=80=AFAM Wang Liang = wrote: > > The syzbot report a crash: > > Oops: general protection fault, probably for non-canonical address 0xfb= d5a5d5a0000003: 0000 [#1] SMP KASAN NOPTI > KASAN: maybe wild-memory-access in range [0xdead4ead00000018-0xdead4ead= 0000001f] > CPU: 1 UID: 0 PID: 6949 Comm: syz.0.335 Not tainted syzkaller #0 PREEMP= T(full) > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS= Google 08/18/2025 > RIP: 0010:smc_diag_msg_common_fill net/smc/smc_diag.c:44 [inline] > RIP: 0010:__smc_diag_dump.constprop.0+0x3ca/0x2550 net/smc/smc_diag.c:8= 9 > Call Trace: > > smc_diag_dump_proto+0x26d/0x420 net/smc/smc_diag.c:217 > smc_diag_dump+0x27/0x90 net/smc/smc_diag.c:234 > netlink_dump+0x539/0xd30 net/netlink/af_netlink.c:2327 > __netlink_dump_start+0x6d6/0x990 net/netlink/af_netlink.c:2442 > netlink_dump_start include/linux/netlink.h:341 [inline] > smc_diag_handler_dump+0x1f9/0x240 net/smc/smc_diag.c:251 > __sock_diag_cmd net/core/sock_diag.c:249 [inline] > sock_diag_rcv_msg+0x438/0x790 net/core/sock_diag.c:285 > netlink_rcv_skb+0x158/0x420 net/netlink/af_netlink.c:2552 > netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline] > netlink_unicast+0x5a7/0x870 net/netlink/af_netlink.c:1346 > netlink_sendmsg+0x8d1/0xdd0 net/netlink/af_netlink.c:1896 > sock_sendmsg_nosec net/socket.c:714 [inline] > __sock_sendmsg net/socket.c:729 [inline] > ____sys_sendmsg+0xa95/0xc70 net/socket.c:2614 > ___sys_sendmsg+0x134/0x1d0 net/socket.c:2668 > __sys_sendmsg+0x16d/0x220 net/socket.c:2700 > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] > do_syscall_64+0xcd/0x4e0 arch/x86/entry/syscall_64.c:94 > entry_SYSCALL_64_after_hwframe+0x77/0x7f > > > The process like this: > > (CPU1) | (CPU2) > ---------------------------------|------------------------------- > inet_create() | > // init clcsock to NULL | > sk =3D sk_alloc() | > | > // unexpectedly change clcsock | > inet_init_csk_locks() | > | > // add sk to hash table | > smc_inet_init_sock() | > smc_sk_init() | > smc_hash_sk() | > | // traverse the hash table > | smc_diag_dump_proto > | __smc_diag_dump() > | // visit wrong clcsock > | smc_diag_msg_common_fill() > // alloc clcsock | > smc_create_clcsk | > sock_create_kern | > > With CONFIG_DEBUG_LOCK_ALLOC=3Dy, the smc->clcsock is unexpectedly change= d > in inet_init_csk_locks(), because the struct smc_sock does not have struc= t > inet_connection_sock as the first member. > > Previous commit 60ada4fe644e ("smc: Fix various oops due to inet_sock typ= e > confusion.") add inet_sock as the first member of smc_sock. For protocol > with INET_PROTOSW_ICSK, use inet_connection_sock instead of inet_sock is > more appropriate. > > Reported-by: syzbot+f775be4458668f7d220e@syzkaller.appspotmail.com > Closes: https://syzkaller.appspot.com/bug?extid=3Df775be4458668f7d220e > Tested-by: syzbot+f775be4458668f7d220e@syzkaller.appspotmail.com > Fixes: d25a92ccae6b ("net/smc: Introduce IPPROTO_SMC") > Signed-off-by: Wang Liang > --- > net/smc/smc.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/smc/smc.h b/net/smc/smc.h > index 2c9084963739..1b20f0c927d3 100644 > --- a/net/smc/smc.h > +++ b/net/smc/smc.h > @@ -285,7 +285,7 @@ struct smc_connection { > struct smc_sock { /* smc sock container */ > union { > struct sock sk; > - struct inet_sock icsk_inet; > + struct inet_connection_sock inet_conn; > }; > struct socket *clcsock; /* internal tcp socket */ > void (*clcsk_state_change)(struct sock *sk); > -- > 2.34.1 > Kuniyuki, can you please review, I think you had a related fix recently. Thanks. commit 60ada4fe644edaa6c2da97364184b0425e8aeaf5 Author: Kuniyuki Iwashima Date: Fri Jul 11 06:07:52 2025 +0000 smc: Fix various oops due to inet_sock type confusion. From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id AHfiGUWy7WjyFwsAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 02:15:33 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 02:15:33 +0000 Received: from ams.mirrors.kernel.org ([213.196.21.55]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8UZY-00000003H9T-2fjT for hi@josie.lol; Tue, 14 Oct 2025 02:15:33 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.mirrors.kernel.org (Postfix) with ESMTPS id 2A88634EAC6 for ; Tue, 14 Oct 2025 02:15:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5FE341D63C2; Tue, 14 Oct 2025 02:15:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GWYnt6g3" X-Original-To: stable@vger.kernel.org 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 392F041760 for ; Tue, 14 Oct 2025 02:15:27 +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=1760408128; cv=none; b=cflWKzziTnPvZUli+cTY+F20IeLTOJLhY17fnpCPdYABBbnLETDFvbPtOb0RuGHLLTjN4TNxuWMi2Z0IsaMYMgAQMtuP1W9OfcSyyrTAbw9PqafWycYbTxOuJNIxYbCD0HOyyhmm0aKRIZNwLt4zJjqr7P8yoMJ5fUhXhBphETY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760408128; c=relaxed/simple; bh=slIiHk/UGErDnWVRSJT1UmuJHWPf+uHDir/zrgSgqPw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GJ86mOb16c7qbNkOPIIO1IyQz0QyTS2DsB/OZOo9lr60aqAYilCHBjpHoeDfz1tBMQ3Wbq3lSrrtLztRMr1IvHOYV8ORXRanSzvUvm8N6+qbRs9Py2EJW5K3fAps8u5bHeaiKe1lRxpPv+V6QA94d/t8dtlzOGbd8MWTFcbkcDY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GWYnt6g3; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6265C4CEE7; Tue, 14 Oct 2025 02:15:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760408127; bh=slIiHk/UGErDnWVRSJT1UmuJHWPf+uHDir/zrgSgqPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GWYnt6g3EJqEolqSBg1pQ5/XzV7mnOGcdS3L5o96SZwUhsyVc3lZ/XA0w9yJXqW2w AI5Iq8BYQnPxcH1eAcMnAgYvJXQM3VkM2MrxZom24ffyZF/wNEI/NmWB/VSq6XUj/b T5XtfVl9WCEPJ2FQI/OYYktLygnVhj6m8vklkfBFp0JbPcYjwHiPZEEpyRow2l3vLK K80fkSym9yDBAtPOlhQ+vAteAIuECHjEYUAg7QaMYa7RLwrPQdVZjfwf6+sc/ZXgAT JK6zhqSCcval2dVfqEY6VXyjViEzfMz/UxMwWRmCRMq/MYtNUkxR/ZvjMiE82Fc6jy E8nBTBbfV9LZg== From: Sasha Levin To: stable@vger.kernel.org Cc: Yuan Chen , "Masami Hiramatsu (Google)" , Sasha Levin Subject: [PATCH 6.6.y] tracing: Fix race condition in kprobe initialization causing NULL pointer dereference Date: Mon, 13 Oct 2025 22:15:24 -0400 Message-ID: <20251014021524.3834046-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2025101319-either-sizzling-8e94@gregkh> References: <2025101319-either-sizzling-8e94@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.2 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.2 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -11 From: Yuan Chen [ Upstream commit 9cf9aa7b0acfde7545c1a1d912576e9bab28dc6f ] There is a critical race condition in kprobe initialization that can lead to NULL pointer dereference and kernel crash. [1135630.084782] Unable to handle kernel paging request at virtual address 0000710a04630000 ... [1135630.260314] pstate: 404003c9 (nZcv DAIF +PAN -UAO) [1135630.269239] pc : kprobe_perf_func+0x30/0x260 [1135630.277643] lr : kprobe_dispatcher+0x44/0x60 [1135630.286041] sp : ffffaeff4977fa40 [1135630.293441] x29: ffffaeff4977fa40 x28: ffffaf015340e400 [1135630.302837] x27: 0000000000000000 x26: 0000000000000000 [1135630.312257] x25: ffffaf029ed108a8 x24: ffffaf015340e528 [1135630.321705] x23: ffffaeff4977fc50 x22: ffffaeff4977fc50 [1135630.331154] x21: 0000000000000000 x20: ffffaeff4977fc50 [1135630.340586] x19: ffffaf015340e400 x18: 0000000000000000 [1135630.349985] x17: 0000000000000000 x16: 0000000000000000 [1135630.359285] x15: 0000000000000000 x14: 0000000000000000 [1135630.368445] x13: 0000000000000000 x12: 0000000000000000 [1135630.377473] x11: 0000000000000000 x10: 0000000000000000 [1135630.386411] x9 : 0000000000000000 x8 : 0000000000000000 [1135630.395252] x7 : 0000000000000000 x6 : 0000000000000000 [1135630.403963] x5 : 0000000000000000 x4 : 0000000000000000 [1135630.412545] x3 : 0000710a04630000 x2 : 0000000000000006 [1135630.421021] x1 : ffffaeff4977fc50 x0 : 0000710a04630000 [1135630.429410] Call trace: [1135630.434828] kprobe_perf_func+0x30/0x260 [1135630.441661] kprobe_dispatcher+0x44/0x60 [1135630.448396] aggr_pre_handler+0x70/0xc8 [1135630.454959] kprobe_breakpoint_handler+0x140/0x1e0 [1135630.462435] brk_handler+0xbc/0xd8 [1135630.468437] do_debug_exception+0x84/0x138 [1135630.475074] el1_dbg+0x18/0x8c [1135630.480582] security_file_permission+0x0/0xd0 [1135630.487426] vfs_write+0x70/0x1c0 [1135630.493059] ksys_write+0x5c/0xc8 [1135630.498638] __arm64_sys_write+0x24/0x30 [1135630.504821] el0_svc_common+0x78/0x130 [1135630.510838] el0_svc_handler+0x38/0x78 [1135630.516834] el0_svc+0x8/0x1b0 kernel/trace/trace_kprobe.c: 1308 0xffff3df8995039ec : ldr x21, [x24,#120] include/linux/compiler.h: 294 0xffff3df8995039f0 : ldr x1, [x21,x0] kernel/trace/trace_kprobe.c 1308: head = this_cpu_ptr(call->perf_events); 1309: if (hlist_empty(head)) 1310: return 0; crash> struct trace_event_call -o struct trace_event_call { ... [120] struct hlist_head *perf_events; //(call->perf_event) ... } crash> struct trace_event_call ffffaf015340e528 struct trace_event_call { ... perf_events = 0xffff0ad5fa89f088, //this value is correct, but x21 = 0 ... } Race Condition Analysis: The race occurs between kprobe activation and perf_events initialization: CPU0 CPU1 ==== ==== perf_kprobe_init perf_trace_event_init tp_event->perf_events = list;(1) tp_event->class->reg (2)← KPROBE ACTIVE Debug exception triggers ... kprobe_dispatcher kprobe_perf_func (tk->tp.flags & TP_FLAG_PROFILE) head = this_cpu_ptr(call->perf_events)(3) (perf_events is still NULL) Problem: 1. CPU0 executes (1) assigning tp_event->perf_events = list 2. CPU0 executes (2) enabling kprobe functionality via class->reg() 3. CPU1 triggers and reaches kprobe_dispatcher 4. CPU1 checks TP_FLAG_PROFILE - condition passes (step 2 completed) 5. CPU1 calls kprobe_perf_func() and crashes at (3) because call->perf_events is still NULL CPU1 sees that kprobe functionality is enabled but does not see that perf_events has been assigned. Add pairing read and write memory barriers to guarantee that if CPU1 sees that kprobe functionality is enabled, it must also see that perf_events has been assigned. Link: https://lore.kernel.org/all/20251001022025.44626-1-chenyuan_fl@163.com/ Fixes: 50d780560785 ("tracing/kprobes: Add probe handler dispatcher to support perf and ftrace concurrent use") Cc: stable@vger.kernel.org Signed-off-by: Yuan Chen Signed-off-by: Masami Hiramatsu (Google) [ Adjust context ] Signed-off-by: Sasha Levin --- kernel/trace/trace_fprobe.c | 11 +++++++---- kernel/trace/trace_kprobe.c | 11 +++++++---- kernel/trace/trace_probe.h | 9 +++++++-- kernel/trace/trace_uprobe.c | 12 ++++++++---- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/kernel/trace/trace_fprobe.c b/kernel/trace/trace_fprobe.c index 93620a7835876..a233262f858c8 100644 --- a/kernel/trace/trace_fprobe.c +++ b/kernel/trace/trace_fprobe.c @@ -342,12 +342,14 @@ static int fentry_dispatcher(struct fprobe *fp, unsigned long entry_ip, void *entry_data) { struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp); + unsigned int flags = trace_probe_load_flag(&tf->tp); int ret = 0; - if (trace_probe_test_flag(&tf->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) fentry_trace_func(tf, entry_ip, regs); + #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tf->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret = fentry_perf_func(tf, entry_ip, regs); #endif return ret; @@ -359,11 +361,12 @@ static void fexit_dispatcher(struct fprobe *fp, unsigned long entry_ip, void *entry_data) { struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp); + unsigned int flags = trace_probe_load_flag(&tf->tp); - if (trace_probe_test_flag(&tf->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) fexit_trace_func(tf, entry_ip, ret_ip, regs, entry_data); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tf->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) fexit_perf_func(tf, entry_ip, ret_ip, regs, entry_data); #endif } diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index 46491f3c1569c..20dbe40ab15e8 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -1713,14 +1713,15 @@ static int kprobe_register(struct trace_event_call *event, static int kprobe_dispatcher(struct kprobe *kp, struct pt_regs *regs) { struct trace_kprobe *tk = container_of(kp, struct trace_kprobe, rp.kp); + unsigned int flags = trace_probe_load_flag(&tk->tp); int ret = 0; raw_cpu_inc(*tk->nhit); - if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) kprobe_trace_func(tk, regs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret = kprobe_perf_func(tk, regs); #endif return ret; @@ -1732,6 +1733,7 @@ kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) { struct kretprobe *rp = get_kretprobe(ri); struct trace_kprobe *tk; + unsigned int flags; /* * There is a small chance that get_kretprobe(ri) returns NULL when @@ -1744,10 +1746,11 @@ kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) tk = container_of(rp, struct trace_kprobe, rp); raw_cpu_inc(*tk->nhit); - if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tk->tp); + if (flags & TP_FLAG_TRACE) kretprobe_trace_func(tk, ri, regs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) kretprobe_perf_func(tk, ri, regs); #endif return 0; /* We don't tweak kernel, so just return 0 */ diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h index 48afed3c3f88e..c71fa9c2f3815 100644 --- a/kernel/trace/trace_probe.h +++ b/kernel/trace/trace_probe.h @@ -268,16 +268,21 @@ struct event_file_link { struct list_head list; }; +static inline unsigned int trace_probe_load_flag(struct trace_probe *tp) +{ + return smp_load_acquire(&tp->event->flags); +} + static inline bool trace_probe_test_flag(struct trace_probe *tp, unsigned int flag) { - return !!(tp->event->flags & flag); + return !!(trace_probe_load_flag(tp) & flag); } static inline void trace_probe_set_flag(struct trace_probe *tp, unsigned int flag) { - tp->event->flags |= flag; + smp_store_release(&tp->event->flags, tp->event->flags | flag); } static inline void trace_probe_clear_flag(struct trace_probe *tp, diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index ecf04e81ddf70..03d79a9ebd8c8 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c @@ -1514,6 +1514,7 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs) struct trace_uprobe *tu; struct uprobe_dispatch_data udd; struct uprobe_cpu_buffer *ucb = NULL; + unsigned int flags; int ret = 0; tu = container_of(con, struct trace_uprobe, consumer); @@ -1527,11 +1528,12 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs) if (WARN_ON_ONCE(!uprobe_cpu_buffer)) return 0; - if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tu->tp); + if (flags & TP_FLAG_TRACE) ret |= uprobe_trace_func(tu, regs, &ucb); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret |= uprobe_perf_func(tu, regs, &ucb); #endif uprobe_buffer_put(ucb); @@ -1544,6 +1546,7 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, struct trace_uprobe *tu; struct uprobe_dispatch_data udd; struct uprobe_cpu_buffer *ucb = NULL; + unsigned int flags; tu = container_of(con, struct trace_uprobe, consumer); @@ -1555,11 +1558,12 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, if (WARN_ON_ONCE(!uprobe_cpu_buffer)) return 0; - if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tu->tp); + if (flags & TP_FLAG_TRACE) uretprobe_trace_func(tu, func, regs, &ucb); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) uretprobe_perf_func(tu, func, regs, &ucb); #endif uprobe_buffer_put(ucb); -- 2.51.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id ANJSK7e37Ghy5gUAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 08:26:31 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 08:26:31 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8Dt0-000000022Hw-2qIm for hi@josie.lol; Mon, 13 Oct 2025 08:26:31 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2E197188C97C for ; Mon, 13 Oct 2025 08:26:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 698A12F0694; Mon, 13 Oct 2025 08:26:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ix2fd72E" X-Original-To: stable@vger.kernel.org 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 3AB0A2EFDAC for ; Mon, 13 Oct 2025 08:26:22 +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=1760343985; cv=none; b=TwKOwFo7tS0z2PpMvbW3fvR4v8pZJcspvOP6yvSX5MuQxOIH0fj9jBi31YXlXYvso6BodEZDiwzvx7JCc8v/QEcb/wAGT1J29+qk02fLy0lFrrBlWJG449KMMzWmCki9gk6rK7uJpi+1Sll4+uUgqTROIUHkTW6YGbY8Hr5kuHc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760343985; c=relaxed/simple; bh=3sh07SjldTM08OiT4GhU+DVmRWACXfkWIq6LwdFjsTk=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=I388YTOrGeViQnmN2vrFJGawRmIY0UTiy3FN5TVRtxef/6idiV+xmZzUeLYcQsDvMfAeWroI6g2V65KL4dnZ5kHuc2I1CbLQFapaI8V/SxM0kj1DRiq+SsnKF7HU5oEaGZFQN17Iwa0eAK2QSD0DtmYkwH1kk1yNGL5ndQZ7r4o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ix2fd72E; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E220C4CEE7; Mon, 13 Oct 2025 08:26:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760343982; bh=3sh07SjldTM08OiT4GhU+DVmRWACXfkWIq6LwdFjsTk=; h=Subject:To:Cc:From:Date:From; b=ix2fd72EeqqOE+85tzlHCwvPjrV/OsgWD0GvHku59IwQMxB/obVhEMtlUrX3wkzg7 73S2bO+iATF/+AioU1sJzUKlzvdDnsIRk7MGlgQfFuJG0USGHy7ijeeQMwr+kQgYPq bSQomeq8mLJVcoGmHw+UN1rB4aON8oIuRLDG4thg= Subject: FAILED: patch "[PATCH] tracing: Fix race condition in kprobe initialization causing" failed to apply to 6.6-stable tree To: chenyuan@kylinos.cn,mhiramat@kernel.org Cc: From: Date: Mon, 13 Oct 2025 10:26:19 +0200 Message-ID: <2025101319-either-sizzling-8e94@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-DKIM: signer='linuxfoundation.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linuxfoundation.org] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [147.75.80.249 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -18 The patch below does not apply to the 6.6-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y git checkout FETCH_HEAD git cherry-pick -x 9cf9aa7b0acfde7545c1a1d912576e9bab28dc6f # git commit -s git send-email --to '' --in-reply-to '2025101319-either-sizzling-8e94@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 9cf9aa7b0acfde7545c1a1d912576e9bab28dc6f Mon Sep 17 00:00:00 2001 From: Yuan Chen Date: Wed, 1 Oct 2025 03:20:25 +0100 Subject: [PATCH] tracing: Fix race condition in kprobe initialization causing NULL pointer dereference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is a critical race condition in kprobe initialization that can lead to NULL pointer dereference and kernel crash. [1135630.084782] Unable to handle kernel paging request at virtual address 0000710a04630000 ... [1135630.260314] pstate: 404003c9 (nZcv DAIF +PAN -UAO) [1135630.269239] pc : kprobe_perf_func+0x30/0x260 [1135630.277643] lr : kprobe_dispatcher+0x44/0x60 [1135630.286041] sp : ffffaeff4977fa40 [1135630.293441] x29: ffffaeff4977fa40 x28: ffffaf015340e400 [1135630.302837] x27: 0000000000000000 x26: 0000000000000000 [1135630.312257] x25: ffffaf029ed108a8 x24: ffffaf015340e528 [1135630.321705] x23: ffffaeff4977fc50 x22: ffffaeff4977fc50 [1135630.331154] x21: 0000000000000000 x20: ffffaeff4977fc50 [1135630.340586] x19: ffffaf015340e400 x18: 0000000000000000 [1135630.349985] x17: 0000000000000000 x16: 0000000000000000 [1135630.359285] x15: 0000000000000000 x14: 0000000000000000 [1135630.368445] x13: 0000000000000000 x12: 0000000000000000 [1135630.377473] x11: 0000000000000000 x10: 0000000000000000 [1135630.386411] x9 : 0000000000000000 x8 : 0000000000000000 [1135630.395252] x7 : 0000000000000000 x6 : 0000000000000000 [1135630.403963] x5 : 0000000000000000 x4 : 0000000000000000 [1135630.412545] x3 : 0000710a04630000 x2 : 0000000000000006 [1135630.421021] x1 : ffffaeff4977fc50 x0 : 0000710a04630000 [1135630.429410] Call trace: [1135630.434828] kprobe_perf_func+0x30/0x260 [1135630.441661] kprobe_dispatcher+0x44/0x60 [1135630.448396] aggr_pre_handler+0x70/0xc8 [1135630.454959] kprobe_breakpoint_handler+0x140/0x1e0 [1135630.462435] brk_handler+0xbc/0xd8 [1135630.468437] do_debug_exception+0x84/0x138 [1135630.475074] el1_dbg+0x18/0x8c [1135630.480582] security_file_permission+0x0/0xd0 [1135630.487426] vfs_write+0x70/0x1c0 [1135630.493059] ksys_write+0x5c/0xc8 [1135630.498638] __arm64_sys_write+0x24/0x30 [1135630.504821] el0_svc_common+0x78/0x130 [1135630.510838] el0_svc_handler+0x38/0x78 [1135630.516834] el0_svc+0x8/0x1b0 kernel/trace/trace_kprobe.c: 1308 0xffff3df8995039ec : ldr x21, [x24,#120] include/linux/compiler.h: 294 0xffff3df8995039f0 : ldr x1, [x21,x0] kernel/trace/trace_kprobe.c 1308: head = this_cpu_ptr(call->perf_events); 1309: if (hlist_empty(head)) 1310: return 0; crash> struct trace_event_call -o struct trace_event_call { ... [120] struct hlist_head *perf_events; //(call->perf_event) ... } crash> struct trace_event_call ffffaf015340e528 struct trace_event_call { ... perf_events = 0xffff0ad5fa89f088, //this value is correct, but x21 = 0 ... } Race Condition Analysis: The race occurs between kprobe activation and perf_events initialization: CPU0 CPU1 ==== ==== perf_kprobe_init perf_trace_event_init tp_event->perf_events = list;(1) tp_event->class->reg (2)← KPROBE ACTIVE Debug exception triggers ... kprobe_dispatcher kprobe_perf_func (tk->tp.flags & TP_FLAG_PROFILE) head = this_cpu_ptr(call->perf_events)(3) (perf_events is still NULL) Problem: 1. CPU0 executes (1) assigning tp_event->perf_events = list 2. CPU0 executes (2) enabling kprobe functionality via class->reg() 3. CPU1 triggers and reaches kprobe_dispatcher 4. CPU1 checks TP_FLAG_PROFILE - condition passes (step 2 completed) 5. CPU1 calls kprobe_perf_func() and crashes at (3) because call->perf_events is still NULL CPU1 sees that kprobe functionality is enabled but does not see that perf_events has been assigned. Add pairing read and write memory barriers to guarantee that if CPU1 sees that kprobe functionality is enabled, it must also see that perf_events has been assigned. Link: https://lore.kernel.org/all/20251001022025.44626-1-chenyuan_fl@163.com/ Fixes: 50d780560785 ("tracing/kprobes: Add probe handler dispatcher to support perf and ftrace concurrent use") Cc: stable@vger.kernel.org Signed-off-by: Yuan Chen Signed-off-by: Masami Hiramatsu (Google) diff --git a/kernel/trace/trace_fprobe.c b/kernel/trace/trace_fprobe.c index b36ade43d4b3..ad9d6347b5fa 100644 --- a/kernel/trace/trace_fprobe.c +++ b/kernel/trace/trace_fprobe.c @@ -522,13 +522,14 @@ static int fentry_dispatcher(struct fprobe *fp, unsigned long entry_ip, void *entry_data) { struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp); + unsigned int flags = trace_probe_load_flag(&tf->tp); int ret = 0; - if (trace_probe_test_flag(&tf->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) fentry_trace_func(tf, entry_ip, fregs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tf->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret = fentry_perf_func(tf, entry_ip, fregs); #endif return ret; @@ -540,11 +541,12 @@ static void fexit_dispatcher(struct fprobe *fp, unsigned long entry_ip, void *entry_data) { struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp); + unsigned int flags = trace_probe_load_flag(&tf->tp); - if (trace_probe_test_flag(&tf->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) fexit_trace_func(tf, entry_ip, ret_ip, fregs, entry_data); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tf->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) fexit_perf_func(tf, entry_ip, ret_ip, fregs, entry_data); #endif } diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index fa60362a3f31..ee8171b19bee 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -1815,14 +1815,15 @@ static int kprobe_register(struct trace_event_call *event, static int kprobe_dispatcher(struct kprobe *kp, struct pt_regs *regs) { struct trace_kprobe *tk = container_of(kp, struct trace_kprobe, rp.kp); + unsigned int flags = trace_probe_load_flag(&tk->tp); int ret = 0; raw_cpu_inc(*tk->nhit); - if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) kprobe_trace_func(tk, regs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret = kprobe_perf_func(tk, regs); #endif return ret; @@ -1834,6 +1835,7 @@ kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) { struct kretprobe *rp = get_kretprobe(ri); struct trace_kprobe *tk; + unsigned int flags; /* * There is a small chance that get_kretprobe(ri) returns NULL when @@ -1846,10 +1848,11 @@ kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) tk = container_of(rp, struct trace_kprobe, rp); raw_cpu_inc(*tk->nhit); - if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tk->tp); + if (flags & TP_FLAG_TRACE) kretprobe_trace_func(tk, ri, regs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) kretprobe_perf_func(tk, ri, regs); #endif return 0; /* We don't tweak kernel, so just return 0 */ diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h index 842383fbc03b..08b5bda24da2 100644 --- a/kernel/trace/trace_probe.h +++ b/kernel/trace/trace_probe.h @@ -271,16 +271,21 @@ struct event_file_link { struct list_head list; }; +static inline unsigned int trace_probe_load_flag(struct trace_probe *tp) +{ + return smp_load_acquire(&tp->event->flags); +} + static inline bool trace_probe_test_flag(struct trace_probe *tp, unsigned int flag) { - return !!(tp->event->flags & flag); + return !!(trace_probe_load_flag(tp) & flag); } static inline void trace_probe_set_flag(struct trace_probe *tp, unsigned int flag) { - tp->event->flags |= flag; + smp_store_release(&tp->event->flags, tp->event->flags | flag); } static inline void trace_probe_clear_flag(struct trace_probe *tp, diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index 8b0bcc0d8f41..430d09c49462 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c @@ -1547,6 +1547,7 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs, struct trace_uprobe *tu; struct uprobe_dispatch_data udd; struct uprobe_cpu_buffer *ucb = NULL; + unsigned int flags; int ret = 0; tu = container_of(con, struct trace_uprobe, consumer); @@ -1561,11 +1562,12 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs, if (WARN_ON_ONCE(!uprobe_cpu_buffer)) return 0; - if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tu->tp); + if (flags & TP_FLAG_TRACE) ret |= uprobe_trace_func(tu, regs, &ucb); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret |= uprobe_perf_func(tu, regs, &ucb); #endif uprobe_buffer_put(ucb); @@ -1579,6 +1581,7 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, struct trace_uprobe *tu; struct uprobe_dispatch_data udd; struct uprobe_cpu_buffer *ucb = NULL; + unsigned int flags; tu = container_of(con, struct trace_uprobe, consumer); @@ -1590,11 +1593,12 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, if (WARN_ON_ONCE(!uprobe_cpu_buffer)) return 0; - if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tu->tp); + if (flags & TP_FLAG_TRACE) uretprobe_trace_func(tu, func, regs, &ucb); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) uretprobe_perf_func(tu, func, regs, &ucb); #endif uprobe_buffer_put(ucb); From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id 2GmKLnOy7WiyMwkAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 02:16:19 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 02:16:19 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8UaI-00000003IUY-2Mbe for hi@josie.lol; Tue, 14 Oct 2025 02:16:19 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 7DB664E5EFD for ; Tue, 14 Oct 2025 02:16:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D57491D63C2; Tue, 14 Oct 2025 02:16:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="l45ttzq9" X-Original-To: stable@vger.kernel.org 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 A664541760 for ; Tue, 14 Oct 2025 02:16:13 +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=1760408175; cv=none; b=MPwsPVrmnM8a705WH6K5GZu4NJFh20B/RVli3e+4IEM6yZI7M1kHc83crpFNuBaT4k7MOoPaj2Oezv17RZzHALPQ/+MqgLh9wL0eGxs1I3E8XRi6ZuHZ0JzuZ511XNpSeQsZYACIrLQPEdPKWx0DjY0HrT12Ts+78QJ4D6PbX2c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760408175; c=relaxed/simple; bh=lqw3qA8Ms4xTKJFO8i4sFm/YwxGgPyC/01pyEUL3RaQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cZDxUXv+DN54GeYr9Z1p6UwU+bFKqDGe93kXdcJ0NedHUJReBZMKZGtGcuRiXxnIDlYIc4JoAOEjW/pfuR5o+0aG/i3KmMLuR9bSvkO4mQXcJ9sOdekawPCg6JwLfVNlw7tH0mGDDuTjUS3arGa5qGh4algXrmCBJn6Upb1aE3o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=l45ttzq9; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FE0FC4CEE7; Tue, 14 Oct 2025 02:16:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760408173; bh=lqw3qA8Ms4xTKJFO8i4sFm/YwxGgPyC/01pyEUL3RaQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l45ttzq9f0ZnbS2hbaWijpUwypsSiDnjxF5CfBRGT5na9cF5H+/ExD1EjfK1WreVd pCrqMw3aRrnsIm7dKg4sFSlnNGiBSEO9gf+2+u5gCNMu8WxLjDUmAzO4TWUcV0R6Fr qEjdsOfn6tbTidQhza+7gk1u3KP5ydv1bhMtYvkSTEx1XDb8vmZPtvmHwkQqSGepS4 lAjYAnHLaKIbXKmyPjdDcwivUmwDhVTrqnR8KhH89Zi04oqavo3+MBI8+aeSjvYofL yLeTRWalrIZm7YhPzdpz1e3HW8AloUL2XTD3R9OYIW5EmCxgcZioeOtJRRYUlG/nay EfKsa5f96hi0A== From: Sasha Levin To: stable@vger.kernel.org Cc: Zheng Qixing , Mikulas Patocka , Sasha Levin Subject: [PATCH 5.15.y] dm: fix NULL pointer dereference in __dm_suspend() Date: Mon, 13 Oct 2025 22:16:10 -0400 Message-ID: <20251014021610.3835566-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2025101315-graveness-treason-be2b@gregkh> References: <2025101315-graveness-treason-be2b@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.2 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.2 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -11 From: Zheng Qixing [ Upstream commit 8d33a030c566e1f105cd5bf27f37940b6367f3be ] There is a race condition between dm device suspend and table load that can lead to null pointer dereference. The issue occurs when suspend is invoked before table load completes: BUG: kernel NULL pointer dereference, address: 0000000000000054 Oops: 0000 [#1] PREEMPT SMP PTI CPU: 6 PID: 6798 Comm: dmsetup Not tainted 6.6.0-g7e52f5f0ca9b #62 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.1-2.fc37 04/01/2014 RIP: 0010:blk_mq_wait_quiesce_done+0x0/0x50 Call Trace: blk_mq_quiesce_queue+0x2c/0x50 dm_stop_queue+0xd/0x20 __dm_suspend+0x130/0x330 dm_suspend+0x11a/0x180 dev_suspend+0x27e/0x560 ctl_ioctl+0x4cf/0x850 dm_ctl_ioctl+0xd/0x20 vfs_ioctl+0x1d/0x50 __se_sys_ioctl+0x9b/0xc0 __x64_sys_ioctl+0x19/0x30 x64_sys_call+0x2c4a/0x4620 do_syscall_64+0x9e/0x1b0 The issue can be triggered as below: T1 T2 dm_suspend table_load __dm_suspend dm_setup_md_queue dm_mq_init_request_queue blk_mq_init_allocated_queue => q->mq_ops = set->ops; (1) dm_stop_queue / dm_wait_for_completion => q->tag_set NULL pointer! (2) => q->tag_set = set; (3) Fix this by checking if a valid table (map) exists before performing request-based suspend and waiting for target I/O. When map is NULL, skip these table-dependent suspend steps. Even when map is NULL, no I/O can reach any target because there is no table loaded; I/O submitted in this state will fail early in the DM layer. Skipping the table-dependent suspend logic in this case is safe and avoids NULL pointer dereferences. Fixes: c4576aed8d85 ("dm: fix request-based dm's use of dm_wait_for_completion") Cc: stable@vger.kernel.org Signed-off-by: Zheng Qixing Signed-off-by: Mikulas Patocka [ omitted DMF_QUEUE_STOPPED flag setting and braces absent in 5.15 ] Signed-off-by: Sasha Levin --- drivers/md/dm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 8b192fc1f798c..26bc77d205864 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -2406,7 +2406,7 @@ static int __dm_suspend(struct mapped_device *md, struct dm_table *map, { bool do_lockfs = suspend_flags & DM_SUSPEND_LOCKFS_FLAG; bool noflush = suspend_flags & DM_SUSPEND_NOFLUSH_FLAG; - int r; + int r = 0; lockdep_assert_held(&md->suspend_lock); @@ -2458,7 +2458,7 @@ static int __dm_suspend(struct mapped_device *md, struct dm_table *map, * Stop md->queue before flushing md->wq in case request-based * dm defers requests to md->wq from md->queue. */ - if (dm_request_based(md)) + if (map && dm_request_based(md)) dm_stop_queue(md->queue); flush_workqueue(md->wq); @@ -2468,7 +2468,8 @@ static int __dm_suspend(struct mapped_device *md, struct dm_table *map, * We call dm_wait_for_completion to wait for all existing requests * to finish. */ - r = dm_wait_for_completion(md, task_state); + if (map) + r = dm_wait_for_completion(md, task_state); if (!r) set_bit(dmf_suspended_flag, &md->flags); -- 2.51.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id aGU8N37C7Ghz3AwAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 09:12:30 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 09:12:30 +0000 Received: from ams.mirrors.kernel.org ([213.196.21.55]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8EbW-00000003acM-21Nk for hi@josie.lol; Mon, 13 Oct 2025 09:12:30 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.mirrors.kernel.org (Postfix) with ESMTPS id 44F7134421E for ; Mon, 13 Oct 2025 09:12:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 777DF2FC019; Mon, 13 Oct 2025 09:12:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="oRFM3s9w" X-Original-To: stable@vger.kernel.org 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 53AF92FC010 for ; Mon, 13 Oct 2025 09:12:18 +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=1760346738; cv=none; b=nRp2X9Y97vskgp3D0vKQf7XYjw7VyhDQwf7z0MvGPQY+5UAecJ2kkFhMqctAVBPP73ruILyelGr8F6NgkzvNh53bHTmhAsKQbU7XvjqQWtp8L6HYN+EaDSi2QpYTstkASy/ge+w9slua+aqkxPdFZRQ/KS7mkXWpT+0DmUGBoh0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760346738; c=relaxed/simple; bh=XCAEnSwTu5V9vlAV9jkG3wA4w/uyYkCcJ03tuLV0J3o=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=WGd0ZgnuJtxlAY3WzIqJTkzlsLyeNleAAYtOVip9vstg+8YT5sT9SWS5C5AiFYpgFbH3n0GMbGGn2qjB5HwPIJdgllENSMMAtHpG4PQAPqHEnX/d5v1AIcK81XdqFxn+aJkQET49zTbeauscRG8m33cg9g9CsXRdXDmTCqSYbPE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=oRFM3s9w; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1BC5C4CEE7; Mon, 13 Oct 2025 09:12:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760346738; bh=XCAEnSwTu5V9vlAV9jkG3wA4w/uyYkCcJ03tuLV0J3o=; h=Subject:To:Cc:From:Date:From; b=oRFM3s9w5rK577Kw1a5/jrCOyVJrqV8vLk1Rm8Xd+YuvdCtLYTDs3JKH5ItJitGh1 iXnSm3MmZH/T1BGJ6Wni/QL0lSze/9TpFF33ImK43hskuu5/wi0FWf/nWfxRzCnYcl pnFNOAbS+97tpUfncUfZgRccmTcirYBB2aT8UaZM= Subject: FAILED: patch "[PATCH] dm: fix NULL pointer dereference in __dm_suspend()" failed to apply to 5.15-stable tree To: zhengqixing@huawei.com,mpatocka@redhat.com Cc: From: Date: Mon, 13 Oct 2025 11:12:15 +0200 Message-ID: <2025101315-graveness-treason-be2b@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit X-DKIM: signer='linuxfoundation.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linuxfoundation.org] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [213.196.21.55 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: 4 The patch below does not apply to the 5.15-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y git checkout FETCH_HEAD git cherry-pick -x 8d33a030c566e1f105cd5bf27f37940b6367f3be # git commit -s git send-email --to '' --in-reply-to '2025101315-graveness-treason-be2b@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 8d33a030c566e1f105cd5bf27f37940b6367f3be Mon Sep 17 00:00:00 2001 From: Zheng Qixing Date: Tue, 26 Aug 2025 15:42:04 +0800 Subject: [PATCH] dm: fix NULL pointer dereference in __dm_suspend() There is a race condition between dm device suspend and table load that can lead to null pointer dereference. The issue occurs when suspend is invoked before table load completes: BUG: kernel NULL pointer dereference, address: 0000000000000054 Oops: 0000 [#1] PREEMPT SMP PTI CPU: 6 PID: 6798 Comm: dmsetup Not tainted 6.6.0-g7e52f5f0ca9b #62 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.1-2.fc37 04/01/2014 RIP: 0010:blk_mq_wait_quiesce_done+0x0/0x50 Call Trace: blk_mq_quiesce_queue+0x2c/0x50 dm_stop_queue+0xd/0x20 __dm_suspend+0x130/0x330 dm_suspend+0x11a/0x180 dev_suspend+0x27e/0x560 ctl_ioctl+0x4cf/0x850 dm_ctl_ioctl+0xd/0x20 vfs_ioctl+0x1d/0x50 __se_sys_ioctl+0x9b/0xc0 __x64_sys_ioctl+0x19/0x30 x64_sys_call+0x2c4a/0x4620 do_syscall_64+0x9e/0x1b0 The issue can be triggered as below: T1 T2 dm_suspend table_load __dm_suspend dm_setup_md_queue dm_mq_init_request_queue blk_mq_init_allocated_queue => q->mq_ops = set->ops; (1) dm_stop_queue / dm_wait_for_completion => q->tag_set NULL pointer! (2) => q->tag_set = set; (3) Fix this by checking if a valid table (map) exists before performing request-based suspend and waiting for target I/O. When map is NULL, skip these table-dependent suspend steps. Even when map is NULL, no I/O can reach any target because there is no table loaded; I/O submitted in this state will fail early in the DM layer. Skipping the table-dependent suspend logic in this case is safe and avoids NULL pointer dereferences. Fixes: c4576aed8d85 ("dm: fix request-based dm's use of dm_wait_for_completion") Cc: stable@vger.kernel.org Signed-off-by: Zheng Qixing Signed-off-by: Mikulas Patocka diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 7222f20c1a83..66dd5f6ce778 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -2908,7 +2908,7 @@ static int __dm_suspend(struct mapped_device *md, struct dm_table *map, { bool do_lockfs = suspend_flags & DM_SUSPEND_LOCKFS_FLAG; bool noflush = suspend_flags & DM_SUSPEND_NOFLUSH_FLAG; - int r; + int r = 0; lockdep_assert_held(&md->suspend_lock); @@ -2960,7 +2960,7 @@ static int __dm_suspend(struct mapped_device *md, struct dm_table *map, * Stop md->queue before flushing md->wq in case request-based * dm defers requests to md->wq from md->queue. */ - if (dm_request_based(md)) { + if (map && dm_request_based(md)) { dm_stop_queue(md->queue); set_bit(DMF_QUEUE_STOPPED, &md->flags); } @@ -2972,7 +2972,8 @@ static int __dm_suspend(struct mapped_device *md, struct dm_table *map, * We call dm_wait_for_completion to wait for all existing requests * to finish. */ - r = dm_wait_for_completion(md, task_state); + if (map) + r = dm_wait_for_completion(md, task_state); if (!r) set_bit(dmf_suspended_flag, &md->flags); From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id CNojJ8227WjIKwkAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 02:34:53 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 02:34:53 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8UsH-00000003s35-0SuA for hi@josie.lol; Tue, 14 Oct 2025 02:34:53 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A0E8D18A6AD4 for ; Tue, 14 Oct 2025 02:35:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A50F21DF256; Tue, 14 Oct 2025 02:34:48 +0000 (UTC) X-Original-To: stable@vger.kernel.org Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EAEC81C862D for ; Tue, 14 Oct 2025 02:34:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760409288; cv=none; b=fWlbMYmWa4AWeLnFUjM341YiGVUDXXKs4FbhojJv7QQ+wMpzt9XRPy8v0iSm5wes1+IwNLKMG/+I6vA05olhwLAVTcO+YMLt8finmgt1chvDtWwTp5WgotpO4T8Tef46PEwX8YEwLVZWNuRYzBcfG1uERmAaiTRS3y0tTcJFXS0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760409288; c=relaxed/simple; bh=FBaR5plMALEkJWdbIpfcbTys5ckgMqepQG119/TWh4M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mdMEZ2zykIFMK3kFeJBVQBSknuu9kp2t+ILlGrVpzxI2lBvbLR4e4DsIF2t5wMqABMxG4QptnunH5hDlV+yuaXNziXG5FZuEEK0Id9+Xp1aSQRGVaX0kMe7JfTjdk4v1QZjytycOqgltb6BA5sMSH/BkBoEz7VjOB7jOEDvIMWo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-78af3fe5b17so3821061b3a.2 for ; Mon, 13 Oct 2025 19:34:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760409286; x=1761014086; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hZjisJgnzE8Y+BY1h4B2KaiB1xBx662MQM1196IO0b0=; b=JOrpwAJqIUhZAlF9SYGMIwMB8MQyhPReUvjt2s/yEfmjoLwKUciLE1S+JmuFwqLqtI 51/AqEbVn3bq7voZjABWdVfDfM4LUNcHfrzJRCScjp5JWbEiNUwSvKiRYZK0BsRu7skx AZKpTUA5O6xzFX4Fuhmr0dI24HVWLnrC3lBNY99X8rn/xgnjOalwIj8o1xzInqTdXhxk 66UGlXXPkaYQicWqvzDjR7dxial5+n1CF99zGzG6JjIkExguJwgXFlMnW8FmyHRPzvPP aCfWTkYtKG1dpW6OGbvhbp8bklaWOr05r7LAlGt5/ll8xHvjWWKj5s2FtCVUvAR6u1D+ Xdxg== X-Gm-Message-State: AOJu0YxgOvpdyqaFPfj8znbGwgub6pwxXKz/QkRJ7Y6luXEJhhPaN/Vz nUV4yjx2q4ZKK6T0a6rSJHWkCnVZZIY1z65FEUzC0BQjBuDkCLTzd4wCr+IM+nWw X-Gm-Gg: ASbGncsJ8C5jQqRvexaYIFA6PPC/YjZ5gfNm6S6SWALHL2IVeJ6VKaJ2QU2NK8T7aZN VO/RTagz9rl1cmGv2pqeso5BidUl1ci986GD9mSkssaEhCQi5n4h6xBhBuRtb8ZaN+L+uYfbJ7Q 3wU9e3IHmJqTgSed7spz1HcsWLXDapRDukeJpLC3EJICdOuaLHvRUEfDRiVfkiJ1MksGw2xeB6B tkE5JKKyxWxr1odcvtkEwNyGjy0rS+Uo5i99aTSFTDB7yn3vhVoSAQPe7QYuAbT2sPlM123SwI1 OmH2xKsiixRZJ5QvSSFH2OP80SPQ9RTfGYcqABnlhTOqy9vqUdhagaHf+/Kd7wyZu02kPts5/TU EbvKsWlOW/Ny1CGJNWYyHBaOPmAqE/g== X-Google-Smtp-Source: AGHT+IHAt1umQylxa4/Yajbo01iA4gOrM9C/4jJR27f0749sEEubSjiAiTZ3/Ohup96fdMKMZ2M4DQ== X-Received: by 2002:a05:6a00:a0a:b0:77d:13e3:cd08 with SMTP id d2e1a72fcca58-793859f64aemr27785297b3a.5.1760409285802; Mon, 13 Oct 2025 19:34:45 -0700 (PDT) Received: from EBJ9932692.tcent.cn ([2a11:3:200::202c]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7992b060c4esm13322561b3a.14.2025.10.13.19.34.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Oct 2025 19:34:45 -0700 (PDT) From: Lance Yang To: stable@vger.kernel.org Cc: linux-mm@kvack.org, ioworker0@gmail.com, Lance Yang , David Hildenbrand , Lorenzo Stoakes , Shuah Khan , Gabriel Krisman Bertazi , Andrew Morton Subject: [PATCH 6.12.y 1/1] selftests/mm: skip soft-dirty tests when CONFIG_MEM_SOFT_DIRTY is disabled Date: Tue, 14 Oct 2025 10:34:28 +0800 Message-ID: <20251014023428.26814-1-lance.yang@linux.dev> X-Mailer: git-send-email 2.49.0 In-Reply-To: <2025101329-cyclic-cylinder-9e6b@gregkh> References: <2025101329-cyclic-cylinder-9e6b@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.5 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.80.249 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 5 From: Lance Yang The madv_populate and soft-dirty kselftests currently fail on systems where CONFIG_MEM_SOFT_DIRTY is disabled. Introduce a new helper softdirty_supported() into vm_util.c/h to ensure tests are properly skipped when the feature is not enabled. Link: https://lkml.kernel.org/r/20250917133137.62802-1-lance.yang@linux.dev Fixes: 9f3265db6ae8 ("selftests: vm: add test for Soft-Dirty PTE bit") Signed-off-by: Lance Yang Acked-by: David Hildenbrand Suggested-by: David Hildenbrand Cc: Lorenzo Stoakes Cc: Shuah Khan Cc: Gabriel Krisman Bertazi Cc: Signed-off-by: Andrew Morton (cherry picked from commit 0389c305ef56cbadca4cbef44affc0ec3213ed30) --- tools/testing/selftests/mm/madv_populate.c | 21 +----- tools/testing/selftests/mm/soft-dirty.c | 5 +- tools/testing/selftests/mm/vm_util.c | 77 ++++++++++++++++++++++ tools/testing/selftests/mm/vm_util.h | 1 + 4 files changed, 84 insertions(+), 20 deletions(-) diff --git a/tools/testing/selftests/mm/madv_populate.c b/tools/testing/selftests/mm/madv_populate.c index ef7d911da13e..16f5754b8b1f 100644 --- a/tools/testing/selftests/mm/madv_populate.c +++ b/tools/testing/selftests/mm/madv_populate.c @@ -264,23 +264,6 @@ static void test_softdirty(void) munmap(addr, SIZE); } -static int system_has_softdirty(void) -{ - /* - * There is no way to check if the kernel supports soft-dirty, other - * than by writing to a page and seeing if the bit was set. But the - * tests are intended to check that the bit gets set when it should, so - * doing that check would turn a potentially legitimate fail into a - * skip. Fortunately, we know for sure that arm64 does not support - * soft-dirty. So for now, let's just use the arch as a corse guide. - */ -#if defined(__aarch64__) - return 0; -#else - return 1; -#endif -} - int main(int argc, char **argv) { int nr_tests = 16; @@ -288,7 +271,7 @@ int main(int argc, char **argv) pagesize = getpagesize(); - if (system_has_softdirty()) + if (softdirty_supported()) nr_tests += 5; ksft_print_header(); @@ -300,7 +283,7 @@ int main(int argc, char **argv) test_holes(); test_populate_read(); test_populate_write(); - if (system_has_softdirty()) + if (softdirty_supported()) test_softdirty(); err = ksft_get_fail_cnt(); diff --git a/tools/testing/selftests/mm/soft-dirty.c b/tools/testing/selftests/mm/soft-dirty.c index bdfa5d085f00..7b91df12ce5b 100644 --- a/tools/testing/selftests/mm/soft-dirty.c +++ b/tools/testing/selftests/mm/soft-dirty.c @@ -193,8 +193,11 @@ int main(int argc, char **argv) int pagesize; ksft_print_header(); - ksft_set_plan(15); + if (!softdirty_supported()) + ksft_exit_skip("soft-dirty is not support\n"); + + ksft_set_plan(15); pagemap_fd = open(PAGEMAP_FILE_PATH, O_RDONLY); if (pagemap_fd < 0) ksft_exit_fail_msg("Failed to open %s\n", PAGEMAP_FILE_PATH); diff --git a/tools/testing/selftests/mm/vm_util.c b/tools/testing/selftests/mm/vm_util.c index d8d0cf04bb57..a4a2805d3d3e 100644 --- a/tools/testing/selftests/mm/vm_util.c +++ b/tools/testing/selftests/mm/vm_util.c @@ -193,6 +193,42 @@ unsigned long rss_anon(void) return rss_anon; } +char *__get_smap_entry(void *addr, const char *pattern, char *buf, size_t len) +{ + int ret; + FILE *fp; + char *entry = NULL; + char addr_pattern[MAX_LINE_LENGTH]; + + ret = snprintf(addr_pattern, MAX_LINE_LENGTH, "%08lx-", + (unsigned long)addr); + if (ret >= MAX_LINE_LENGTH) + ksft_exit_fail_msg("%s: Pattern is too long\n", __func__); + + fp = fopen(SMAP_FILE_PATH, "r"); + if (!fp) + ksft_exit_fail_msg("%s: Failed to open file %s\n", __func__, + SMAP_FILE_PATH); + + if (!check_for_pattern(fp, addr_pattern, buf, len)) + goto err_out; + + /* Fetch the pattern in the same block */ + if (!check_for_pattern(fp, pattern, buf, len)) + goto err_out; + + /* Trim trailing newline */ + entry = strchr(buf, '\n'); + if (entry) + *entry = '\0'; + + entry = buf + strlen(pattern); + +err_out: + fclose(fp); + return entry; +} + bool __check_huge(void *addr, char *pattern, int nr_hpages, uint64_t hpage_size) { @@ -384,3 +420,44 @@ unsigned long get_free_hugepages(void) fclose(f); return fhp; } + +static bool check_vmflag(void *addr, const char *flag) +{ + char buffer[MAX_LINE_LENGTH]; + const char *flags; + size_t flaglen; + + flags = __get_smap_entry(addr, "VmFlags:", buffer, sizeof(buffer)); + if (!flags) + ksft_exit_fail_msg("%s: No VmFlags for %p\n", __func__, addr); + + while (true) { + flags += strspn(flags, " "); + + flaglen = strcspn(flags, " "); + if (!flaglen) + return false; + + if (flaglen == strlen(flag) && !memcmp(flags, flag, flaglen)) + return true; + + flags += flaglen; + } +} + +bool softdirty_supported(void) +{ + char *addr; + bool supported = false; + const size_t pagesize = getpagesize(); + + /* New mappings are expected to be marked with VM_SOFTDIRTY (sd). */ + addr = mmap(0, pagesize, PROT_READ | PROT_WRITE, + MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); + if (!addr) + ksft_exit_fail_msg("mmap failed\n"); + + supported = check_vmflag(addr, "sd"); + munmap(addr, pagesize); + return supported; +} diff --git a/tools/testing/selftests/mm/vm_util.h b/tools/testing/selftests/mm/vm_util.h index 2eaed8209925..823d07d84ad0 100644 --- a/tools/testing/selftests/mm/vm_util.h +++ b/tools/testing/selftests/mm/vm_util.h @@ -53,6 +53,7 @@ int uffd_unregister(int uffd, void *addr, uint64_t len); int uffd_register_with_ioctls(int uffd, void *addr, uint64_t len, bool miss, bool wp, bool minor, uint64_t *ioctls); unsigned long get_free_hugepages(void); +bool softdirty_supported(void); /* * On ppc64 this will only work with radix 2M hugepage size -- 2.49.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id CFbVDenl7GjtIx0AYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 11:43:37 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 11:43:37 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8Gxk-00000008fyu-2FCR for hi@josie.lol; Mon, 13 Oct 2025 11:43:37 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7C2123B4A9B for ; Mon, 13 Oct 2025 11:43:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BA0972571B0; Mon, 13 Oct 2025 11:43:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="q4bOblGs" X-Original-To: stable@vger.kernel.org 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 93B8E255F2C for ; Mon, 13 Oct 2025 11:43:32 +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=1760355812; cv=none; b=iJc+AdvDtfThpdAYX9B8vy+vkYDbL+TpaO3nqQu69D1odgLzPjICHZUFDfKd5yT/Wk3gwPZnukSzVDEHaIZmc2cD4kCCoPdjkS2rKvi6LJ9uFk4pY2cUewuywNiGLhhcMlhL4VX9E/fPEjDpjyjdD0TR0PbxHUB1TpSGYwPHw1U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760355812; c=relaxed/simple; bh=Ba6QIHv8zM3ZfztJ8nwOrPR9sybTE3FNPsuzmlcBxY0=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=jjUhIFC0WsukT0ky4MMZzTF9UyXB8j6zPn7BSSCO83dnnoHsihS5E3GQMzXPAqSjFEFnJBHuBrwnj9vYxkV+C2XgH37P8jEZfUJENL2h96w0U+HXMnQxcEljXPdVkS2zlI2R3rbgWNIalQAM66OTLzDneTbRlVba1U/iW7gdWGk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=q4bOblGs; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C146FC4CEE7; Mon, 13 Oct 2025 11:43:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760355812; bh=Ba6QIHv8zM3ZfztJ8nwOrPR9sybTE3FNPsuzmlcBxY0=; h=Subject:To:Cc:From:Date:From; b=q4bOblGswe24mH4j7IUNvRmGLOiRUW/V6cSf/68wbogKjXWm+xMPW5yFEHHIIKvIL qji2E8KC0FoGCYi7J32NN1/sh9m7JCihqTXSsytew/ykc8YjJiPQ/5tpmUVrxynTqc Do4ujNiJeRBGLWqlfToeeIwYggXVtOKsfFmPAes4= Subject: FAILED: patch "[PATCH] selftests/mm: skip soft-dirty tests when" failed to apply to 6.12-stable tree To: lance.yang@linux.dev,akpm@linux-foundation.org,david@redhat.com,krisman@collabora.com,lorenzo.stoakes@oracle.com,shuah@kernel.org,stable@vger.kernel.org Cc: From: Date: Mon, 13 Oct 2025 13:43:29 +0200 Message-ID: <2025101329-cyclic-cylinder-9e6b@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit X-DKIM: signer='linuxfoundation.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linuxfoundation.org] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: 4 The patch below does not apply to the 6.12-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y git checkout FETCH_HEAD git cherry-pick -x 0389c305ef56cbadca4cbef44affc0ec3213ed30 # git commit -s git send-email --to '' --in-reply-to '2025101329-cyclic-cylinder-9e6b@gregkh' --subject-prefix 'PATCH 6.12.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 0389c305ef56cbadca4cbef44affc0ec3213ed30 Mon Sep 17 00:00:00 2001 From: Lance Yang Date: Wed, 17 Sep 2025 21:31:37 +0800 Subject: [PATCH] selftests/mm: skip soft-dirty tests when CONFIG_MEM_SOFT_DIRTY is disabled The madv_populate and soft-dirty kselftests currently fail on systems where CONFIG_MEM_SOFT_DIRTY is disabled. Introduce a new helper softdirty_supported() into vm_util.c/h to ensure tests are properly skipped when the feature is not enabled. Link: https://lkml.kernel.org/r/20250917133137.62802-1-lance.yang@linux.dev Fixes: 9f3265db6ae8 ("selftests: vm: add test for Soft-Dirty PTE bit") Signed-off-by: Lance Yang Acked-by: David Hildenbrand Suggested-by: David Hildenbrand Cc: Lorenzo Stoakes Cc: Shuah Khan Cc: Gabriel Krisman Bertazi Cc: Signed-off-by: Andrew Morton diff --git a/tools/testing/selftests/mm/madv_populate.c b/tools/testing/selftests/mm/madv_populate.c index b6fabd5c27ed..d8d11bc67ddc 100644 --- a/tools/testing/selftests/mm/madv_populate.c +++ b/tools/testing/selftests/mm/madv_populate.c @@ -264,23 +264,6 @@ static void test_softdirty(void) munmap(addr, SIZE); } -static int system_has_softdirty(void) -{ - /* - * There is no way to check if the kernel supports soft-dirty, other - * than by writing to a page and seeing if the bit was set. But the - * tests are intended to check that the bit gets set when it should, so - * doing that check would turn a potentially legitimate fail into a - * skip. Fortunately, we know for sure that arm64 does not support - * soft-dirty. So for now, let's just use the arch as a corse guide. - */ -#if defined(__aarch64__) - return 0; -#else - return 1; -#endif -} - int main(int argc, char **argv) { int nr_tests = 16; @@ -288,7 +271,7 @@ int main(int argc, char **argv) pagesize = getpagesize(); - if (system_has_softdirty()) + if (softdirty_supported()) nr_tests += 5; ksft_print_header(); @@ -300,7 +283,7 @@ int main(int argc, char **argv) test_holes(); test_populate_read(); test_populate_write(); - if (system_has_softdirty()) + if (softdirty_supported()) test_softdirty(); err = ksft_get_fail_cnt(); diff --git a/tools/testing/selftests/mm/soft-dirty.c b/tools/testing/selftests/mm/soft-dirty.c index 8a3f2b4b2186..4ee4db3750c1 100644 --- a/tools/testing/selftests/mm/soft-dirty.c +++ b/tools/testing/selftests/mm/soft-dirty.c @@ -200,8 +200,11 @@ int main(int argc, char **argv) int pagesize; ksft_print_header(); - ksft_set_plan(15); + if (!softdirty_supported()) + ksft_exit_skip("soft-dirty is not support\n"); + + ksft_set_plan(15); pagemap_fd = open(PAGEMAP_FILE_PATH, O_RDONLY); if (pagemap_fd < 0) ksft_exit_fail_msg("Failed to open %s\n", PAGEMAP_FILE_PATH); diff --git a/tools/testing/selftests/mm/vm_util.c b/tools/testing/selftests/mm/vm_util.c index 56e9bd541edd..e33cda301dad 100644 --- a/tools/testing/selftests/mm/vm_util.c +++ b/tools/testing/selftests/mm/vm_util.c @@ -449,6 +449,23 @@ bool check_vmflag_pfnmap(void *addr) return check_vmflag(addr, "pf"); } +bool softdirty_supported(void) +{ + char *addr; + bool supported = false; + const size_t pagesize = getpagesize(); + + /* New mappings are expected to be marked with VM_SOFTDIRTY (sd). */ + addr = mmap(0, pagesize, PROT_READ | PROT_WRITE, + MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); + if (!addr) + ksft_exit_fail_msg("mmap failed\n"); + + supported = check_vmflag(addr, "sd"); + munmap(addr, pagesize); + return supported; +} + /* * Open an fd at /proc/$pid/maps and configure procmap_out ready for * PROCMAP_QUERY query. Returns 0 on success, or an error code otherwise. diff --git a/tools/testing/selftests/mm/vm_util.h b/tools/testing/selftests/mm/vm_util.h index 07c4acfd84b6..26c30fdc0241 100644 --- a/tools/testing/selftests/mm/vm_util.h +++ b/tools/testing/selftests/mm/vm_util.h @@ -104,6 +104,7 @@ bool find_vma_procmap(struct procmap_fd *procmap, void *address); int close_procmap(struct procmap_fd *procmap); int write_sysfs(const char *file_path, unsigned long val); int read_sysfs(const char *file_path, unsigned long *val); +bool softdirty_supported(void); static inline int open_self_procmap(struct procmap_fd *procmap_out) { From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id oLkfBL247Whj0wsAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 02:43:09 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 02:43:09 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8V0F-000000047qa-3Sj2 for hi@josie.lol; Tue, 14 Oct 2025 02:43:09 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 99A334F74E5 for ; Tue, 14 Oct 2025 02:43:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B95BB305E02; Tue, 14 Oct 2025 02:42:59 +0000 (UTC) X-Original-To: stable@vger.kernel.org Received: from mail-m15597.qiye.163.com (mail-m15597.qiye.163.com [101.71.155.97]) (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 E24D6306D49; Tue, 14 Oct 2025 02:42:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=101.71.155.97 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760409779; cv=none; b=HbrwJlBQAHnPAI5J01dS3/4Vr6RswDJJcy/vUgkrTc5FjytPLYjBXXLOYXlzU6Hdidu7nKNJjhzcfhKfKVFA58FvEbm+GN08zu+dRjlhfHkAdFlwJf6+lUoDHdbBPiQ+1Z2CpsvEPx4IdD1Ip5GGGk2H9N+eP50UndJZb1tsmAg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760409779; c=relaxed/simple; bh=L9Y3eF1geh2+BQ/4saZ/aUi4gJsi0xAL+hVTnEBiCSA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QZe7Lv3zo2ErsDhzKxP81m3UFpKtRH3UwKzMw80vVzq2RpWByqdj/BjDs42NSrF/i8WaOFWMnFAuvHDRi7LX81u6XbJDJamlA0xQrX8c21DZEt4swb62etQObVzBOHfezAH7ksBkaMKn2wRgAmLsJNPukNctmy7McqIj0N2iy5M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=easystack.cn; spf=pass smtp.mailfrom=easystack.cn; arc=none smtp.client-ip=101.71.155.97 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=easystack.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=easystack.cn Received: from localhost.localdomain (unknown [218.94.118.90]) by smtp.qiye.163.com (Hmail) with ESMTP id 117e7b8a4; Tue, 14 Oct 2025 10:37:38 +0800 (GMT+08:00) From: Zhen Ni To: Frank.Li@nxp.com, vkoul@kernel.org Cc: imx@lists.linux.dev, dmaengine@vger.kernel.org, Zhen Ni , stable@vger.kernel.org Subject: [PATCH v3] dmaengine: fsl-edma: Fix clk leak on alloc_chan_resources failure Date: Tue, 14 Oct 2025 10:37:28 +0800 Message-Id: <20251014023728.749845-1-zhen.ni@easystack.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20251011030620.315732-1-zhen.ni@easystack.cn> References: <20251011030620.315732-1-zhen.ni@easystack.cn> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-HM-Tid: 0a99e09496740229kunm914d1350367853 X-HM-MType: 1 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFJQjdXWS1ZQUlXWQ8JGhUIEh9ZQVkZQx1MVh0eHkhKTRgeHU1PGFYVFAkWGhdVGRETFh oSFyQUDg9ZV1kYEgtZQVlJSkNVQk9VSkpDVUJLWVdZFhoPEhUdFFlBWU9LSFVKS0lPT09IVUpLS1 VKQktLWQY+ X-Spam-Score: 0.5 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 5 When fsl_edma_alloc_chan_resources() fails after clk_prepare_enable(), the error paths only free IRQs and destroy the TCD pool, but forget to call clk_disable_unprepare(). This causes the channel clock to remain enabled, leaking power and resources. Fix it by disabling the channel clock in the error unwind path. Fixes: d8d4355861d8 ("dmaengine: fsl-edma: add i.MX8ULP edma support") Cc: stable@vger.kernel.org Suggested-by: Frank Li Signed-off-by: Zhen Ni --- Changes in v2: - Remove FSL_EDMA_DRV_HAS_CHCLK check Changes in v3: - Remove cleanup --- drivers/dma/fsl-edma-common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index 4976d7dde080..11655dcc4d6c 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -852,6 +852,7 @@ int fsl_edma_alloc_chan_resources(struct dma_chan *chan) free_irq(fsl_chan->txirq, fsl_chan); err_txirq: dma_pool_destroy(fsl_chan->tcd_pool); + clk_disable_unprepare(fsl_chan->clk); return ret; } -- 2.20.1 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id 4L6mCqdX7WjY2BwAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 19:48:55 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 19:48:55 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8OXO-00000007wMS-3oXc for hi@josie.lol; Mon, 13 Oct 2025 19:48:55 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 05B884E142D for ; Mon, 13 Oct 2025 19:48:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7D2C12D8790; Mon, 13 Oct 2025 19:48:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="JlL8vZIa" X-Original-To: stable@vger.kernel.org Received: from PA4PR04CU001.outbound.protection.outlook.com (mail-francecentralazon11013001.outbound.protection.outlook.com [40.107.162.1]) (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 5177F27FD52; Mon, 13 Oct 2025 19:48:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.162.1 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760384930; cv=fail; b=XJ8vQZanNDvc6pXvdNkYF43nkt1M0HKlpQq6wWw2YcvFRfKnTN4OmOforgB8BjvbROQO7jHtFZvlfl/tU9g/qblROsy121wReSpyFLAK6I20PdraPEDtT/cMUMwCdzaKGa+i/7ukA+rJTUMD1PgJvxIeFLaOMp5baFA7tZoVCe4= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760384930; c=relaxed/simple; bh=aW6xtLRCODzO05uoXyK4ZVMUcbHQ5ELqhfF6J8qWbV8=; h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=a2NjFpCHPm/7UaHwzn5VTJrvVmb31utQbUmcgAJZus82SjC8WuIlm/IZlH2w92rHEmID8D9zkUGXhs0g3+Q8P7XyV9ZZbHy+zX8ZAo2vNI4KmEA5hCz07dKZlH6B3+WwbaOYOOKoIbSvdq8PJ0S0lzy2ownrbnTk22kZr11Cb4A= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=JlL8vZIa; arc=fail smtp.client-ip=40.107.162.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=anwOpJFdT5c9KTbhDazwsNxD7vwyCXaFdtWWvJYskr2rLRbqIrSWV0IJ4JMHdzOui1DAVurfiGseYkaQKxuPScQSNB2TEvHprWxlJx8WfrO2HfAOW1I8ulRX5dopXl6XnfIHDWM18wjIxLqrFc0hd8EiNZStY4S0Okl1k68dOUPqad171rdWqH64BVjJZYXFXrFwqshhAIAgdK8ixR0LDtFJwP5tvx0bMPuG3CvziYgqsKFQ1M6orour+3LEAzv+M5mpj8MicxQUv6VhxJbzBQ+mv1GGaJUZybB5tppsf614qbuaA1IGiGNfZGPNDQBwrVUSbPti+Jak46ljFHNmQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=C4mk6kWyHCaYZMu6UAhVEb0Q1DGGKDVTgJdkEPuRo+w=; b=wKaNiCyGs+UscB4TPFIoMqnQkXAFXAGt0m4Z+oVy6+ABePx+0m/jr3LuIN0yDHZo7DniY3O+jlZWCpCzDPFAQdfsjvff2JRdugz1HLJ9aVFy7sCv5p5BJYHFwLhyZSBeGuwrlOZChv8Utt+cSSz+mx7tsRr4AZJkEnDQZD2esKfYUhwySD0TAA8WEkORsRQll1LiHPdlP9MngZwUI4if+Www+vuOD9Pw8rhSoDGpe3Ako1dSegXJCdke/1fN+M+OlOMaPCSlGRFuwaeLHeDaM6CCqqcMyD6Yll2RINt0q7YSSYcp/Rlqjty52uAp9pF4Ojtqjb8NO762Ci00Wkx7Zw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=C4mk6kWyHCaYZMu6UAhVEb0Q1DGGKDVTgJdkEPuRo+w=; b=JlL8vZIahjwbwp2YEE52jgzxr4dvJqSQGj1DhIIJUmK1JJILPr+IfwcJ64pGiL4B+lEXHBVLd529Zem7kdq0Zw08E+ZNGu5cNwkz1nAREATPLdjJuZUo3+ql/r38TPZvMK4VtljhspLbYXlT08Cya6GZh3uDvkK854XjdNhte8dFkHWfU1/83zLr5yi/uKVYBi7i7M3lN9rNxR1nhK+XTKn6kEyEswCG0s63jFtpt5WkAft/CKZikEuJCyVMg3eLfXSSOhD/kXSd7qqHkDWb2+87gCB0k2A7kjHFhI39FOvV0G1HRmfGS0HZ32aasvxAzzbIngqL2Kyll3i5g7udLA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB9PR04MB9626.eurprd04.prod.outlook.com (2603:10a6:10:309::18) by AS5PR04MB9798.eurprd04.prod.outlook.com (2603:10a6:20b:654::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9203.12; Mon, 13 Oct 2025 19:48:45 +0000 Received: from DB9PR04MB9626.eurprd04.prod.outlook.com ([fe80::55ef:fa41:b021:b5dd]) by DB9PR04MB9626.eurprd04.prod.outlook.com ([fe80::55ef:fa41:b021:b5dd%4]) with mapi id 15.20.9203.009; Mon, 13 Oct 2025 19:48:45 +0000 Date: Mon, 13 Oct 2025 15:48:34 -0400 From: Frank Li To: Zhen Ni Cc: vkoul@kernel.org, imx@lists.linux.dev, dmaengine@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2] dmaengine: fsl-edma: Fix clk leak on alloc_chan_resources failure Message-ID: References: <20251010090257.212694-1-zhen.ni@easystack.cn> <20251011030620.315732-1-zhen.ni@easystack.cn> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251011030620.315732-1-zhen.ni@easystack.cn> X-ClientProxiedBy: SJ0PR05CA0052.namprd05.prod.outlook.com (2603:10b6:a03:33f::27) To AS4PR04MB9621.eurprd04.prod.outlook.com (2603:10a6:20b:4ff::22) Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR04MB9626:EE_|AS5PR04MB9798:EE_ X-MS-Office365-Filtering-Correlation-Id: 4bcbdc79-82d9-44da-3103-08de0a918281 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|19092799006|52116014|376014|366016|1800799024|38350700014|7053199007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Me8tx2opE999k0DyHKNDxj+VYc4/L7sypUXgbN7HPeyXPyFdgJbPAYM/InX5?= =?us-ascii?Q?a8G1tOOlkk9zgHZsD0wqKexpErFyKz1P62fYF/vCgJsykXiYkwGEV04SyYCX?= =?us-ascii?Q?EIW3G+VnXmbSl6dJpL2GUrKn43uJFb0g2M2Ftt3ekcALomXGglTJNmUjI1cS?= =?us-ascii?Q?4FH1Fpmi52BL63ffVrV+4TXRMmxVvSy7el26UBL/Tvj/SxEWMvk1pTHk5FI5?= =?us-ascii?Q?pK49WoVDTSDDA11DFQQA5WcZrrmrAD3CaWr+TDaIKn4EAl8B04OAi8ntTxeJ?= =?us-ascii?Q?3QV00pF4KRFBDNEQkzyLuKhFcPWNfAdUd0IB8pXODCRSXX8x4zKNuFXY3TXV?= =?us-ascii?Q?DBAVuekoRyUfJpCFOp1UYB+/ajAvhbvTAkmeg0KdJyct14ficjxfjmYIy6sK?= =?us-ascii?Q?kKdRgX/HFlF9pmuInxiIRZ51zBVQyLfDOJR6KenC8wt2NmlK31IFeFn9JP/Y?= =?us-ascii?Q?hP3OBcPIMTFeqhh/HkI/FqClMGq7zyyUN6rlsPe+ZDjxhVQ0Av5oNAqZs58o?= =?us-ascii?Q?jCVgsbHkIx/h6f2X5QTD7PauWcwBj8uBPJrpXyqbM4XJKmDiMziQZjTRsZpg?= =?us-ascii?Q?ZmNzWBbQcKFLNY59yZACOIpZn23ZxVF8gtMSmt/hPGSF/XlfYJTt2Xeihoqd?= =?us-ascii?Q?oG2NN0H8g9Mp7o3fbgRr9Lct7DNsdL8d+lFf/9UhGXWLJM8giLzhzpUruXgl?= =?us-ascii?Q?lTYr6ZuGgeaY6duu8D+OSg5gM8VUQ3oX6VZCwzkReJ8+cG6WxmfrSOM4ll9N?= =?us-ascii?Q?BsGJrBkIcu6kf3AzUB3ojROpRPASm6w4WilBKkHpfnXJVFCbYry6BfVqWpB4?= =?us-ascii?Q?/uppVn1hV3kxlabu4XoEm8IF/v79n6xwcRdOO+4UAYB3SLhCHVpACvnVt4nh?= =?us-ascii?Q?lXe32KsBn1fQ2da3XDlzKpDrpON8R+GI60fO70c23eHJ91iwXtivCsveUmjw?= =?us-ascii?Q?MgYXItCv/AJZ39VdB/ZyT3/UhcP/4CImXmedCb/nfVTW2tDdn7YO2BTjZ0dZ?= =?us-ascii?Q?B29jyeybnbnPjYiuMyBXvtoPy725F34JIhtosHcERyjFN0sMnYdLZy1c2GQ5?= =?us-ascii?Q?wXmuHiUHlEJ4g/WWHvcHSxpyipUkA40RprmojfpYHZCJcIUCOegQUHxcRrIw?= =?us-ascii?Q?LHutUk/YuoF7wmZAzSYjt1+i7MxokZmsCDRxDQqjaY3DoTH+HC/D7BzFXbP3?= =?us-ascii?Q?EFmx4KbyQUvmp9zXkxDEMcBrNBmPhqUSPcVeWWRBSrBs0e161FINQ2DVr+W3?= =?us-ascii?Q?KJlFRhj8HbB5IOYZUf3Mlqnr3X6HdUSMqNBYDdAGWRWvZ/odDTDrBRPTAxXE?= =?us-ascii?Q?VJgImvY1DDGN1owjE2YtfEtjd3Nnyd+DHqMskQ4mk6ZsrlaKdfPNI8uSJA2L?= =?us-ascii?Q?MLDTKNqQiJU7YSFzqiW7MsGNwkNP2EkR0ORWqNzNJHIH0hacqKrmlidaBj2W?= =?us-ascii?Q?g69z2IbroV/rYL1++Vhy+7RUqjpbU6c/5uIj7k4TfFnJyQWtLitL71eeBtv+?= =?us-ascii?Q?NJdP46BU/VWhBVWPhAA1uXFdw2caNML5ddrO?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR04MB9626.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(19092799006)(52116014)(376014)(366016)(1800799024)(38350700014)(7053199007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?8B+2yrVCZd0jwVj3hl6FZrwf6S41jYiZuoN/CWng7MtBG9hF9QsmRd2p7prh?= =?us-ascii?Q?Kqzk6ni+UteGLIQb71+77nXP2FlVinGZxXwGhRfh9d/kEje44Du2N1CprpMD?= =?us-ascii?Q?yqVT+arKHCl7yyDhTzxYfIac9EukcdJS/aWvs65CJlW5q+6lUhDDrK5Fc535?= =?us-ascii?Q?a8mHc/QWbLtA/S8VvUSrjdrS822reQvJPtMzo8E4viVTHAPltnD6+iRLg8b7?= =?us-ascii?Q?goNrQwAnod/+xKkv4JiPx/zCcL/2EpWdWfnuGs6/MChHJ9CWFZQ4pj/QVgmn?= =?us-ascii?Q?Wl9tD0ZXk3dNRALw5QNw3kWFl63n0UnPsXLLB8TxBp12suuXduIB4ybYG+cF?= =?us-ascii?Q?bUhmpzkiGnju8n9fI8TXCEjqS+bmDejz95vugFEhRFpZwuDYaaBiFD2SoSju?= =?us-ascii?Q?0shhXCm0g6C96PaV6bFjnvjWvXQpzVICmxjiyy5S+ufIDIW5+mZKMI1Denj/?= =?us-ascii?Q?i/u3kXxPPUHa5O3d4HYQxr7jreJqjzxocZx/uJDvxS8MLiITAyX6pLAR8sp/?= =?us-ascii?Q?BnEzxs2r882TqzZdkHe/ULL1dlEA2dqdImACyFxvWqeS4e9plp7tiZuONlqL?= =?us-ascii?Q?hW2rDwc/Y+RAxwLgUrWRzbEkKV/C4Wy/pKCulMQlhVGJmHp+sqCiGP2LACzC?= =?us-ascii?Q?AJfNINZvPxKXMGfJxTMdsrO0ixeV2b1HqwHyeibDXaSsx5SFtPCIV06r+olw?= =?us-ascii?Q?cSqgX8GmhccvzWKSfnBvwxL36Dp2ahlb/cS/TvV3m52re33ov6VrQ9msG3jn?= =?us-ascii?Q?qDLHRd5bKjSw/rBJvJ6k0sLBt+dH6WDK4AjxRLpKkI9qYgjmmsL994/wQ8BM?= =?us-ascii?Q?9wZDi1hWknUSoaZuU9Io5N2zd2A7l4iTMwbXC6dJ2WRn1HsysediruEn9Yhh?= =?us-ascii?Q?iUOxB2JcPwXJwQ12UaxG6oxlkiyU9qsuiOCvQ2QUpgYh83J3dv2UziNqPpsN?= =?us-ascii?Q?H5HD4owT7ktAHpnC6m8ipsF9ijGOuKP/+n2aigLUxulAWbn6/yjXQMtxoiQw?= =?us-ascii?Q?NyI1D/WZcrkAhjFqUEEpgf9Gia/XW5uf8BXTUXtdaxf5uePBEXT7hmA0aeid?= =?us-ascii?Q?X2RF4Y88wlm/a9ZVaCXMEK8nXrhaSrUCbKBetNWV4X1KFlba8WEeMV4cnStI?= =?us-ascii?Q?PAv4KO01B1phkr1MoP8Drp/igyTTd6wmuZ8Spa6whUqsYw/jfYTU3WlAmlre?= =?us-ascii?Q?+deKwjI8Ptkvd+5j/oMy9VJPVY0OZWehCqmgHxiiaa5SwdTZdnrDCPf+e15K?= =?us-ascii?Q?IH9Y9Fv8GxTF8Ijg1HOFb5O8VhHh4H6R1wsQGClDZO6tuXGOPXa1yBCo1VBl?= =?us-ascii?Q?IEB+h8SrS3Et5nmJbt+vP+N/CRQx6IWUsG9/+w9FErbeAybvGwvTeRtQRl6p?= =?us-ascii?Q?tJox/fjnwDxKpj6yZrWSsMGOgHaGf3jt/WjzZr4kulm0qFl+C8QPpIp9qQic?= =?us-ascii?Q?D+4tbXmVEUIYmkhWlIlDu3tuA5LCKhdm4j2SIVJrJLQsbACGUedbSOCY0T25?= =?us-ascii?Q?JuoKlgJEjNjvtMeX7cGn79OXB4yi8HdiKrbuvecJ1nhHDP1D9tMYKD87iYx6?= =?us-ascii?Q?Cv9/uJmLjUbvzDJxPH4=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4bcbdc79-82d9-44da-3103-08de0a918281 X-MS-Exchange-CrossTenant-AuthSource: AS4PR04MB9621.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2025 19:48:45.6152 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Udx1Nr737H52/Mi/ru8UGSbcLiLnFioFbpLNsFE6XbhO+knS48dHegN8JGHSZzWYquYfyuKQrgjp5Cv6yTFOtQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB9798 X-DKIM: signer='nxp.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: nxp.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On Sat, Oct 11, 2025 at 11:06:20AM +0800, Zhen Ni wrote: > When fsl_edma_alloc_chan_resources() fails after clk_prepare_enable(), > the error paths only free IRQs and destroy the TCD pool, but forget to > call clk_disable_unprepare(). This causes the channel clock to remain > enabled, leaking power and resources. Since clk_disable_unprepare() is > safe to call with a NULL clk, the FSL_EDMA_DRV_HAS_CHCLK check is > reduntante. > > Fix it by disabling the channel clock in the error unwind path. > Also clean up similar redundant checks in the driver for consistency. > > Fixes: d8d4355861d8 ("dmaengine: fsl-edma: add i.MX8ULP edma support") > Cc: stable@vger.kernel.org > Suggested-by: Frank Li > Signed-off-by: Zhen Ni > --- > Changes in v2: > - Remove FSL_EDMA_DRV_HAS_CHCLK check > --- > drivers/dma/fsl-edma-common.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c > index 4976d7dde080..3007d5b7db55 100644 > --- a/drivers/dma/fsl-edma-common.c > +++ b/drivers/dma/fsl-edma-common.c > @@ -852,6 +852,7 @@ int fsl_edma_alloc_chan_resources(struct dma_chan *chan) > free_irq(fsl_chan->txirq, fsl_chan); > err_txirq: > dma_pool_destroy(fsl_chan->tcd_pool); > + clk_disable_unprepare(fsl_chan->clk); > > return ret; > } > @@ -883,8 +884,7 @@ void fsl_edma_free_chan_resources(struct dma_chan *chan) > fsl_chan->is_sw = false; > fsl_chan->srcid = 0; > fsl_chan->is_remote = false; > - if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_HAS_CHCLK) > - clk_disable_unprepare(fsl_chan->clk); > + clk_disable_unprepare(fsl_chan->clk); I may not say clearly at v1. this is cleanup patch, need seperated patch You need two patches first ones with fixes tags, to fix fsl_edma_alloc_chan_resources()'s problem the second patches to do cleanup, remove redundant check if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_HAS_CHCLK) Frank > } > > void fsl_edma_cleanup_vchan(struct dma_device *dmadev) > -- > 2.20.1 > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id mNV4ANH66WiUxzcAYBR5ng (envelope-from ) for ; Sat, 11 Oct 2025 06:36:01 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Sat, 11 Oct 2025 06:36:01 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v7TCx-0000000GDsu-3mxZ for hi@josie.lol; Sat, 11 Oct 2025 06:36:00 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id BB61E4E1697 for ; Sat, 11 Oct 2025 06:35:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 83CE22147E6; Sat, 11 Oct 2025 06:35:56 +0000 (UTC) X-Original-To: stable@vger.kernel.org Received: from mail-m3290.qiye.163.com (mail-m3290.qiye.163.com [220.197.32.90]) (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 C1A601EDA1E; Sat, 11 Oct 2025 06:35:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.32.90 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760164556; cv=none; b=bp+j9wFSfP9px8lVkgxGGVlMFkqzj7rMhtAh5mFU9nBySvn7n/BU2hw7uKi42sDLxM7oIpqi/mnIMM14a678xPbpfaOlzDb1aSXF+ukbLjGMPLRCW4xyGEY9lLMwo3hbXK9rFYoNfHeXReUHvCdCP6IMOUi1lVOgxL9XeGmyzHk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760164556; c=relaxed/simple; bh=FAYzIYzjI7raN5Ez/3fb9mpfl27NtpBUIy9iShZZGYo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ajLyYW9cNydBepvmGbM71VWIgD/JWS12Nuh+H4beDHZgupOWqA7RzWlfohkbn2xE5jGe3j76DHNHbtpehkcAdcraXJglrGKli6qPyVDp4aFIxp1CO4+6T/HHWBCzEZZRf22RxSh2Cmyl0Ukz3GgiLOk3zLRJMww3BwGNADonpGE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=easystack.cn; spf=pass smtp.mailfrom=easystack.cn; arc=none smtp.client-ip=220.197.32.90 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=easystack.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=easystack.cn Received: from localhost.localdomain (unknown [218.94.118.90]) by smtp.qiye.163.com (Hmail) with ESMTP id 115c4daf0; Sat, 11 Oct 2025 11:06:29 +0800 (GMT+08:00) From: Zhen Ni To: Frank.Li@nxp.com, vkoul@kernel.org Cc: imx@lists.linux.dev, dmaengine@vger.kernel.org, Zhen Ni , stable@vger.kernel.org Subject: [PATCH v2] dmaengine: fsl-edma: Fix clk leak on alloc_chan_resources failure Date: Sat, 11 Oct 2025 11:06:20 +0800 Message-Id: <20251011030620.315732-1-zhen.ni@easystack.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20251010090257.212694-1-zhen.ni@easystack.cn> References: <20251010090257.212694-1-zhen.ni@easystack.cn> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-HM-Tid: 0a99d13bec130229kunm7f66ab3a97c69 X-HM-MType: 1 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFJQjdXWS1ZQUlXWQ8JGhUIEh9ZQVlDSRgaVh5JHh9CTkgdGk1ISlYVFAkWGhdVGRETFh oSFyQUDg9ZV1kYEgtZQVlJSkNVQk9VSkpDVUJLWVdZFhoPEhUdFFlBWU9LSFVKS0lPT09IVUpLS1 VKQktLWQY+ X-Spam-Score: 0.5 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 5 When fsl_edma_alloc_chan_resources() fails after clk_prepare_enable(), the error paths only free IRQs and destroy the TCD pool, but forget to call clk_disable_unprepare(). This causes the channel clock to remain enabled, leaking power and resources. Since clk_disable_unprepare() is safe to call with a NULL clk, the FSL_EDMA_DRV_HAS_CHCLK check is reduntante. Fix it by disabling the channel clock in the error unwind path. Also clean up similar redundant checks in the driver for consistency. Fixes: d8d4355861d8 ("dmaengine: fsl-edma: add i.MX8ULP edma support") Cc: stable@vger.kernel.org Suggested-by: Frank Li Signed-off-by: Zhen Ni --- Changes in v2: - Remove FSL_EDMA_DRV_HAS_CHCLK check --- drivers/dma/fsl-edma-common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index 4976d7dde080..3007d5b7db55 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -852,6 +852,7 @@ int fsl_edma_alloc_chan_resources(struct dma_chan *chan) free_irq(fsl_chan->txirq, fsl_chan); err_txirq: dma_pool_destroy(fsl_chan->tcd_pool); + clk_disable_unprepare(fsl_chan->clk); return ret; } @@ -883,8 +884,7 @@ void fsl_edma_free_chan_resources(struct dma_chan *chan) fsl_chan->is_sw = false; fsl_chan->srcid = 0; fsl_chan->is_remote = false; - if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_HAS_CHCLK) - clk_disable_unprepare(fsl_chan->clk); + clk_disable_unprepare(fsl_chan->clk); } void fsl_edma_cleanup_vchan(struct dma_device *dmadev) -- 2.20.1 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id 0B0eK+AT6WhHuzwAYBR5ng (envelope-from ) for ; Fri, 10 Oct 2025 14:10:40 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Fri, 10 Oct 2025 14:10:40 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v7DpQ-00000001KWC-0RvI for hi@josie.lol; Fri, 10 Oct 2025 14:10:40 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 36F453B34E2 for ; Fri, 10 Oct 2025 14:10:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 50C522F3600; Fri, 10 Oct 2025 14:10:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="nBW9VtQ1" X-Original-To: stable@vger.kernel.org Received: from MRWPR03CU001.outbound.protection.outlook.com (mail-francesouthazon11011061.outbound.protection.outlook.com [40.107.130.61]) (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 2E14028466A; Fri, 10 Oct 2025 14:10:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.130.61 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760105419; cv=fail; b=hciaGmgYEBNSmbsCM6FpyiJR9qFjMSNTfhAtGybgY8Xgwn1fzUA7S0CNX85vgGUd7krDufERjCtPO0XWrpPGkdeaiMAZHvWyTtFEpSaypt/GpjPRFSeHtyFB3n4MfY4ffrBBXNUbueu5L4nijiYHgHJ25cC0MN+aRGd0J0Z6PgA= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760105419; c=relaxed/simple; bh=Ao1JWBrBIO2Thkxp3Yh0oLmsthDuVDUMCUvWZEMsiEA=; h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=EeE1SNkE7LeD6QSY29ricbXpz1R/ktPCj3eV+vMEQlSyrMYq2aHFBMwNRiJR/peevHGY7Mh5CweCoOpHO4EPtjMf6zW7QER7MbF96oJeFpp8+Q+BVkeOsDnlsM4sNv2hfQRGgNOd3Imy0GCfYjclWZUm7CLfhd8qbHd1WmmFr8g= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=nBW9VtQ1; arc=fail smtp.client-ip=40.107.130.61 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AlxzFMUPjA1KOcJCBhhMDrae1ZATd/PgZiNO6DVOeZDrq1PeIMceiHDs7pnt7YmrbPLuhioP4YTW0tUDYczNZ7w4TcnHbeaovVhvOK9cglAvPFBjnuc3n9XBiplFwpBaIlAgSg2wgObhscsLw0D3GCP5kBNYrUJp1cFbuk8bthLkoJPrzYJMWy5XsbnRJKxtN2Oxnu18FlXOtkqtc8qgMwoyZUiv7mbaxE7ujEJ+rTR2hWwUxia2mM72V5eUgEq7rplLiGLGPtzb85KZWaFdwdc1h6QLlU8xDAMkWWHaJawi3sJmue/bOcRyxc7NNSs9NhfSJzJnEgdJ0EbxyJIhzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=l5fwsTxj/eiyJJDNNN6YdGThI8Hv0PoEjcAfKn3nC00=; b=D9FUL/2bQKwl/mtdWA5rHMvhTNo1IZcpa+CIB6sLok0mCtzkOD0+L/DUSf/E+pDotfel1Ot+a8NPwKszo8EQGaCOKJ+6New9h/kCvIhSZEam+7cmPAfUc5zb+dKF/eUhy6d7h/KePWsb5CcaunKy03lgrAwM3I68Opo63E+MQ2HepDnhCDJeFJL0QIv+Sn8QJYZ1MFgQTM1DYZwW1yZEippeN2WgXasYCBv7oqXKX72a14b1CTmgrLkoFUHf38H68ah7qUOju5QT32pz5h7o/M5BTQRKmRgoSLW+oD3uHTlYeB7fy8wBUapZl8dW1AIV2FItAqJY2Nvxp8sNyHJpEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=l5fwsTxj/eiyJJDNNN6YdGThI8Hv0PoEjcAfKn3nC00=; b=nBW9VtQ1r2kBNHnXSWeZM2TfxuvcvD/jwgYGubhfFfpwcMiQLNUQdV0DHrN2Y7Q+7zQ36a9OQ8+Tv7HY4ukprJ6KBQguVD3ATh5X2nmLrDOL5q57PNK6A+8RI38eSWGytGwp2tq75rTVeMwN0BuMqAjgONzxmmsPBsMwA/BGKdiG9JYQ1x6cKOXcN90Zg72juaoXaVONqmEDmQtF2BmHKYM3vjtxFfKYaPqQpZSEw/opIN9jSjMqOeKaIrsNSf6H1pv1rLExmnpFiNzn64vmyEyKze5DuhxNiIlZtx/C2F9qFLl54qP+bs0dt5zSmbr2uvLvz+3ezfz2ccvMNKbFTQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXSPRMB0053.eurprd04.prod.outlook.com (2603:10a6:102:23f::21) by AS8PR04MB7671.eurprd04.prod.outlook.com (2603:10a6:20b:299::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9203.10; Fri, 10 Oct 2025 14:10:14 +0000 Received: from PAXSPRMB0053.eurprd04.prod.outlook.com ([fe80::504f:2a06:4579:5f15]) by PAXSPRMB0053.eurprd04.prod.outlook.com ([fe80::504f:2a06:4579:5f15%6]) with mapi id 15.20.9203.007; Fri, 10 Oct 2025 14:10:14 +0000 Date: Fri, 10 Oct 2025 10:10:07 -0400 From: Frank Li To: Zhen Ni Cc: vkoul@kernel.org, imx@lists.linux.dev, dmaengine@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] dmaengine: fsl-edma: Fix clk leak on alloc_chan_resources failure Message-ID: References: <20251010090257.212694-1-zhen.ni@easystack.cn> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251010090257.212694-1-zhen.ni@easystack.cn> X-ClientProxiedBy: PH5P220CA0010.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:34a::13) To PAXSPRMB0053.eurprd04.prod.outlook.com (2603:10a6:102:23f::21) Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXSPRMB0053:EE_|AS8PR04MB7671:EE_ X-MS-Office365-Filtering-Correlation-Id: 5463f3f5-f97f-4787-30af-08de0806bb38 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|19092799006|366016|376014|52116014|1800799024|7053199007|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?qk/AuM5BEeqyXiAYW6tC8NlYUV97YaNyezqLqJ9nDTrTT/2wAVQhsNrPWhMg?= =?us-ascii?Q?OXhhKCHjGcM2O+RNK4/CH+hR24/BlAbBaXdheGrRmx/gv2Ul3e7uaD1OyJBq?= =?us-ascii?Q?fPHmnb0lkDcumN5RzNbCXIUg1bS3y/2G/6xjQSC1HqnPM5ZRsahoAEESDuZP?= =?us-ascii?Q?hAwZ5doDDd+xihFVXG19vJD+Qn9wBL3hHVrOvdTqKtIrvkvVCV29EqRkhgYX?= =?us-ascii?Q?3kQuSWjH4cNV6Stx+JnZyQ05quwDRoz7TilIX3/z9VWVjZ8Ca/hFz4niUKFe?= =?us-ascii?Q?d4EFXJweD6xH0Yr8RPUETq1mAbsX/IAo45fz12k+8taoexCPmA60gHRUwvrW?= =?us-ascii?Q?ZLUHd1BAPOR2jvCOzm86vdIpRCcwbS0c49u0JpxRC79e7WZr/jLx5t4x5LSF?= =?us-ascii?Q?nX4WhtPTUrN/H2afqaI6EiJYrV7a+v/YL8bexCO1h3p1r52I6JYAwYO8GvyZ?= =?us-ascii?Q?UgYiEtxs1JmfMo/jZh3iuOxenuWVSDYzJeEAmWB5nd6RyMlV6niPs1SJsq73?= =?us-ascii?Q?QmC/GEGaqwbk6f3GSeIocpNxSCab306WMpaGw0nG84irgT14Aku4sasmx1El?= =?us-ascii?Q?m6BY9CsYRcUFbFJktam1dFCIXmWP172PCp91Grijda/Zu5ZGQaw+P7Gvh1RL?= =?us-ascii?Q?jm/WgLGhjBoM7wmGUTd7TLjzcRDOPVTScx9zmc9TW+lfS4ysWy7stXd/F9uA?= =?us-ascii?Q?tstMjVTblghLazs/oZnw6dTIVa1ymV1d7L4xmvuKSiT11xYOJuU4n6LZ/4fs?= =?us-ascii?Q?bgM2NbpXe0LX1KnQJV5xGvpZ1BEUpfLtPyyI0rz0YiHDDRDGOgz/R7D4cMPO?= =?us-ascii?Q?S00WNYxiuQb/uIH9zcI0RWt60nExSnGYGYtPPJ+E56qbTca6RQq8CQzu7YgY?= =?us-ascii?Q?uuEKzalzuZwPlJJyj1qDSt/H4gQa2LgRrB2Qx9GNmnllsGUK2mPhJEuS5Lit?= =?us-ascii?Q?LBNAc/BOgHMw+U01d1MOxeWT9zeizOejs+WFr8sLj3fCcpYh7QpVmsyPoe2/?= =?us-ascii?Q?Quh9qOhtEbUmXagrFlgkQou3xaao4KyaDld1Mnrpint7U0IgE3KqspNpXJxQ?= =?us-ascii?Q?kH8IsJ50rXAYcKJYFtiQrxJHK8lLcUIC+XKHRMR2qCYJIsYtXkkIyiMKMjQN?= =?us-ascii?Q?paKp6Ct91oNDaP3SRVbOyJoq1BqNw94WXk5D3isyGFfwBqgUCa/aMd9LHgAQ?= =?us-ascii?Q?wz/BxEbxN5+fV5IZ6oc2r5itbRBPJRGg+PDvpdBJlZCBHS1uCOSo5PKbn5wJ?= =?us-ascii?Q?BCcxIieacRdNHzfqB2Q8HSucDa+T6mRIYswcxGS2wJPSBQtnkZP1WeNFhaef?= =?us-ascii?Q?tcl2gyI4Xu2IhsEg8UgvL8Qq1bYsC9al1XWHEAkQ45uqZJ2Z8FVbF2GMF456?= =?us-ascii?Q?SgFg/RMtjkfoGPVhstEmWID04H+vnEKKGo6RumhPv+NiN49WMuRv8CVv74Ov?= =?us-ascii?Q?YFAlttIf4grtfsmsplpBShFzkhMo0aAEsVI0eObrbTQGFmk2oDuR1trATlto?= =?us-ascii?Q?dldvlN94t1s59qnoehL/kXdOieVERUO20fo7?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXSPRMB0053.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(19092799006)(366016)(376014)(52116014)(1800799024)(7053199007)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?t/fDe9NMu9GmxS1TT6/L07iRthw9fCcne48v0qNQwInIR25RYVJdL11bNOvL?= =?us-ascii?Q?F0o7s7yqxf058vXHMlYWModcrZLO1r1y+puOz/K9QsRbXYFqZcq8kTAr8a8A?= =?us-ascii?Q?S705TXXrVGiU0nAU1utkH8Jr8rm5KDj0760yUZDa2tRi2Q/KT6KXcHvDiZNt?= =?us-ascii?Q?0vY/7/o+xUPE+kwsXHOfxOW21ddvCOP04MDkZkwJ2SL+Q2RyBsLNsl9hm315?= =?us-ascii?Q?iQm6o6VlFPWTrQalgKKBPUrOUyBFrVKN5vU9dTQbuVD+KFGFNL5sUKgsx1fE?= =?us-ascii?Q?AWAOM8IPSQh3KW2p6uePceYgkT5kQjGMq9jUQQuxSa2fir4Prksui4Z3pod7?= =?us-ascii?Q?4NE1ZWGqgs57ddHU23JVaFzVvBlFhbFbTNCJZTxLgZxEpZPot9wsUBZ4olc0?= =?us-ascii?Q?/RcYeoXVRi+VoN6nzMeCt25c5TZWCBSkYF1WJ0djy7WSdD2KVUlc49q9CWHq?= =?us-ascii?Q?+xoWpAa80k62+Rv4zqgHvmbj/rDUGcjjx0Kdkjxv4qBZ0O61fn1T8VuuvBS2?= =?us-ascii?Q?opTR37lGmtUs0YpZlzfVN2yA9cSG9jUYewauPmRoPdpIqTZulCdfX4OBIOy/?= =?us-ascii?Q?UvgropIlWjSiUXP7kMgXQsG9GpYWFF9qryRc2eSMQ+knOWkEWKqDPag7u9bg?= =?us-ascii?Q?tlXlR3IIlJlspb7BDbrwmbT7q39oNeEd56UFl1M6NsmqtTk3pXN6I0OgWlH3?= =?us-ascii?Q?q5hnEOCI7oD0rMNTZPk29r/Z90cji9IW/MuI1GUzsj3fgz6Zs/6fSqMDb5nX?= =?us-ascii?Q?QyrqVOFG0OXkCoOIWFzijQ2gK0FumLINcq2MJ9A9biBtQxAvQq115mB39ax4?= =?us-ascii?Q?7zuV0d1HpwSMmkdaiiS5r4a4GAcwo3PGVsInbeqYu0twNnzejWgjXQwHnf9X?= =?us-ascii?Q?Ky/ubbma8d+ecRPm1Qrc31VNV/ru6IAabg2vmR7MvutBw+7IKC+gDWDaQLLO?= =?us-ascii?Q?Bl0MG4C2K9nHGZOoULSua368qVvySsgLau0nIYC3Eb0q37C/S9lBFwpPnyFZ?= =?us-ascii?Q?CbfBs2FKqQWHRh5KrZyp0P57ufQ98SQMGyPhR/CSlU7+tX4+wKUubHVMVvV1?= =?us-ascii?Q?dgDSA02hxlXL/GhXrRsLo5HQzAY1C6Dg4BCN58+HYLoh7Dyfe+PZBnWqINlm?= =?us-ascii?Q?2Et3ysIVv7VAWkQVrljK19XOo9R36g0ri8SoNoIfqNok3/57ib1foxQDyB48?= =?us-ascii?Q?ettAb6q4rDyiZ2d6TMgMptJVHasaNllF4FGOmRwAzL6yqnltoZnRFZ2G8Eyv?= =?us-ascii?Q?5xxY7Z8FMoRuKYHixj6qY4Fib+afsh9XojDFdWWsRTWRPZmqI18QyUYQC8EY?= =?us-ascii?Q?SnNq4E45tBV3l0PRt+S2wXMv/eCTMC5uD0MMrBp2tHtwuZxcwDFtflsaLkcN?= =?us-ascii?Q?FElk3tGl/QNPza3WMEEiVj2F1xJXFVe9MRyL2Bj39K8MUQ+Y0dGF9MHsJfsg?= =?us-ascii?Q?GLxmSxcBNA4V+ocTrs35jRltlJ6yV8re5ZRoz5k3Bkt9SljTUol1yeJN0ztD?= =?us-ascii?Q?Gx/Bz0pyBpIHaFZONgxD6IwwvN4Aisd+ipZ0LrJm+E/2WQihdQw552fxzThf?= =?us-ascii?Q?rCqmAZfoAHSuXk74MCD/MS+SpmdUyJFGZ2M1l8tg?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5463f3f5-f97f-4787-30af-08de0806bb38 X-MS-Exchange-CrossTenant-AuthSource: PAXSPRMB0053.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2025 14:10:14.0473 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QG71FPXQ9J14Ou2x6O2aDtUooLTunfZpXgqZ+fBCEA2mX7x8osGo+g8lvQ1ghNUl0U3vbIEg5CzNHKPTSSQSxw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7671 X-DKIM: signer='nxp.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: nxp.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On Fri, Oct 10, 2025 at 05:02:57PM +0800, Zhen Ni wrote: > When fsl_edma_alloc_chan_resources() fails after clk_prepare_enable(), > the error paths only free IRQs and destroy the TCD pool, but forget to > call clk_disable_unprepare(). This causes the channel clock to remain > enabled, leaking power and resources. > > Fix it by disabling the channel clock in the error unwind path. > > Fixes: d8d4355861d8 ("dmaengine: fsl-edma: add i.MX8ULP edma support") > Cc: stable@vger.kernel.org > Signed-off-by: Zhen Ni > --- > drivers/dma/fsl-edma-common.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c > index 4976d7dde080..bd673f08f610 100644 > --- a/drivers/dma/fsl-edma-common.c > +++ b/drivers/dma/fsl-edma-common.c > @@ -852,6 +852,8 @@ int fsl_edma_alloc_chan_resources(struct dma_chan *chan) > free_irq(fsl_chan->txirq, fsl_chan); > err_txirq: > dma_pool_destroy(fsl_chan->tcd_pool); > + if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_HAS_CHCLK) > + clk_disable_unprepare(fsl_chan->clk); Thank you for your fix. clk API do nothing when input is NULL. So check if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_HAS_CHCLK) is reduntante. I saw existed code have such check. You can clean up it. Only need keep check at probe() fsl_chan->clk = devm_clk_get_enabled() Frank > > return ret; > } > -- > 2.20.1 > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id 6Jr0I8vQ6GgNzh8AYBR5ng (envelope-from ) for ; Fri, 10 Oct 2025 09:24:27 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Fri, 10 Oct 2025 09:24:27 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v79MQ-00000009PEM-1aYx for hi@josie.lol; Fri, 10 Oct 2025 09:24:27 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1C6765429EF for ; Fri, 10 Oct 2025 09:19:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7E2EB259CA7; Fri, 10 Oct 2025 09:18:37 +0000 (UTC) X-Original-To: stable@vger.kernel.org Received: from mail-m3297.qiye.163.com (mail-m3297.qiye.163.com [220.197.32.97]) (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 D705D1F4C99; Fri, 10 Oct 2025 09:18:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.32.97 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760087917; cv=none; b=pAy5btswWo4N82fFRANPg+IhuzzyP7zYeISgAVwaedC1r9S30FOrNA+DHY0VlYIXDYY/uJrGcRzH89Ggaglp5mdiu5LP5Hn2zwcYf5rw7Nxl+8A4zGt1tCoMlhzQE2FSsiN3R0lOw7m2vtfq0i0ipkx+JzNTpaAv4ckvcp0VAfg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760087917; c=relaxed/simple; bh=7ZH+y4GwW0ll9Chc7h2vRwCsuxsE0d4guvxwRLiqQAc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=OVYonzHEoVRVSrJvbk8ICrYVQSIuykjwmYCcy+p/Aba+QMfxzlSEj5r/zMxunevhnWUerM5RgdAdrwW2hzc97CSEPKfJrYB+rOyJoKlm245VxHKfG4lr13xIhGtlsDfE/Ao58A9o7aOG1zSsnAckz0FzqqNMP16Zdm+golJReis= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=easystack.cn; spf=pass smtp.mailfrom=easystack.cn; arc=none smtp.client-ip=220.197.32.97 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=easystack.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=easystack.cn Received: from localhost.localdomain (unknown [218.94.118.90]) by smtp.qiye.163.com (Hmail) with ESMTP id 1154d67e2; Fri, 10 Oct 2025 17:03:07 +0800 (GMT+08:00) From: Zhen Ni To: Frank.Li@nxp.com, vkoul@kernel.org Cc: imx@lists.linux.dev, dmaengine@vger.kernel.org, Zhen Ni , stable@vger.kernel.org Subject: [PATCH] dmaengine: fsl-edma: Fix clk leak on alloc_chan_resources failure Date: Fri, 10 Oct 2025 17:02:57 +0800 Message-Id: <20251010090257.212694-1-zhen.ni@easystack.cn> X-Mailer: git-send-email 2.20.1 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-HM-Tid: 0a99cd5c11d40229kunmb4490e2b9daa55 X-HM-MType: 1 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFJQjdXWS1ZQUlXWQ8JGhUIEh9ZQVkZT09LVk1MGh4eSxgfGU5KGVYVFAkWGhdVGRETFh oSFyQUDg9ZV1kYEgtZQVlJSkNVQk9VSkpDVUJLWVdZFhoPEhUdFFlBWU9LSFVKS0lPT09IVUpLS1 VKQktLWQY+ X-Spam-Score: 0.5 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 5 When fsl_edma_alloc_chan_resources() fails after clk_prepare_enable(), the error paths only free IRQs and destroy the TCD pool, but forget to call clk_disable_unprepare(). This causes the channel clock to remain enabled, leaking power and resources. Fix it by disabling the channel clock in the error unwind path. Fixes: d8d4355861d8 ("dmaengine: fsl-edma: add i.MX8ULP edma support") Cc: stable@vger.kernel.org Signed-off-by: Zhen Ni --- drivers/dma/fsl-edma-common.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index 4976d7dde080..bd673f08f610 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -852,6 +852,8 @@ int fsl_edma_alloc_chan_resources(struct dma_chan *chan) free_irq(fsl_chan->txirq, fsl_chan); err_txirq: dma_pool_destroy(fsl_chan->tcd_pool); + if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_HAS_CHCLK) + clk_disable_unprepare(fsl_chan->clk); return ret; } -- 2.20.1 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id 2MjQOMi37Whj0wsAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 02:39:04 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 02:39:04 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8UwK-00000003zxl-1bsY for hi@josie.lol; Tue, 14 Oct 2025 02:39:04 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 8CD434EF688 for ; Tue, 14 Oct 2025 02:39:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E65A8306B32; Tue, 14 Oct 2025 02:38:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="fqOdyATx" X-Original-To: io-uring@vger.kernel.org Received: from mail-oa1-f49.google.com (mail-oa1-f49.google.com [209.85.160.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C4C2D306B2C for ; Tue, 14 Oct 2025 02:38:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760409539; cv=none; b=bcK4WOnfvzF+1B/jgQ5RocP2YcrPN+bZ81RL+bu9fHH+N5IiJbQCY+HVHYO1mWa5+oNMRnjcEqZrt/me1tDADxzJvk29DaTXXXgH49IRYQXcRwEZ3g6ZVvlopmycpPX0FCpFb2sRzbyTrww16jvWeDgKPQZ9NAkJwK0L9EbiXhM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760409539; c=relaxed/simple; bh=XeoEz+BWxO/GEUuwbp8y7/YZ6e6tmUqWW80GEDF9jB0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=HgpaKLvuehtHZi4zHVYBeAz3BmQGiXWHC8ZJHH7TkE8ahxwSBu2PJHJKq9I6MxANc5XnSJcOoNPix0YmT7GWqn9rK9NMEzi2peZHvQwVeZsqSbmpGiBLO3ugQJsUJ6AXX9HHUCXxN98osnS3KgG8rL6347d1xFL9C7kjxGhqU+g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=fqOdyATx; arc=none smtp.client-ip=209.85.160.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Received: by mail-oa1-f49.google.com with SMTP id 586e51a60fabf-3729f8eaa10so891031fac.3 for ; Mon, 13 Oct 2025 19:38:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1760409534; x=1761014334; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=P4L1zhkBqvLQzDevAfrUfktHs5nXflBPR+xwPlqwGNI=; b=fqOdyATxaByLDlljotibKBrmWvBXpnx28MEoc7mBeCjOc9+xO5WQnzgBQZeW55id9x GU2Na8HQiO/5AD2rdZv6JszIaHXyWMqW5DQ6flea3/p0EI2cs2AKMQvmPC+vgQunBzVR ZHoZ0saE8acJNv7P7dzmoN/jPa45M7nVzV1tjmZ0hwvXk9d/70Ukuc0v5eSs6uMSHQpc sQ3tTLf3pRtgP28YqpfYqsP6YAvAz6RJ1xg19Zt/nqANAgiX17iSLh0lORNZagGmK2sB wVmaJRt8txc1LHHrk4i7HUdUWV9K7j9Qn6+SZJYmjLqX+V6l6yrJ+YphMeCwwM+DE6/R L0rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760409534; x=1761014334; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P4L1zhkBqvLQzDevAfrUfktHs5nXflBPR+xwPlqwGNI=; b=Yfs0cP8kaeBZXwBWLvXielDLENYE6AwFFoag3ruXSvqEDQMdxkIhaEmIroXHn6iy3Y K/7OexR+6BDq3TdlntrNnM9QQa6mAOV9DxgqHLkWvq5NNPo3CQv5plvfsHTMOwBaj2KN qBAYo5AhwKSBtmxuqcvizRFMTpiQFW+RMGBLMgbtDw46KUKhYMji/DfbG5RWQlTdKBM8 FxXE6paGZGE4LNqFOjam7dl25+UNcQkW3Du+WSIl3Ui6rWxalpJxB4Br0baGJn5rqfPE se08AgWi273x+gltXGOxJIXFZqtj+QsIjKa54gY41RkzsIjhCXD9KOXd3kVCMT0kjead ViLA== X-Forwarded-Encrypted: i=1; AJvYcCValUbgdVsOIUR+sRxJTqc4xKBICBQ651zdreJEXUaw4gJ4tndRmi1rU0i5+Gd5cc1mRIWdasN22g==@vger.kernel.org X-Gm-Message-State: AOJu0YxVPAJZpVNaJG2KaJ4pJEKCppYh2d7YSY8fQqhusm66mwNsqajv aWfOAugmedfCq6iZu3vkOfO6HyEEGhJdaPy1W0KWV8kCkQCDc3BYA3d6s9V2TznvXoC/COlgBXS pf/cc9orBMgociqNjh0c9byZL7aD0nU2z3b0ShaTOLA== X-Gm-Gg: ASbGncvhUYLVaWDB3wv68Y9jbhByzytAaWDHpwMJmvjV0TRLsQavKYIc6KULHky9W88 1qJ/k8Gw3D4bWZN0Bdq1dpmHRxy06AujlbjXYovmt57BpF4vCOVPwWC+qFVVxsDwwXmvY9kP0P0 TLdgllbp/oH/Uf1+hbs75cK97jFk3rnRN0BBjylnPvSDyVTBVQ4bJv2Dl+G3mSfS0i6blk0nR9Y ckUHHdghxI8Gr34Ga3MD7ZI82glFl6YG5c= X-Google-Smtp-Source: AGHT+IGQB7yz9d/NTqBoNxUfSU6VqXWYlLIOaf82MjkY0LCd2An9VUVdyDl70ezObbIGAYkR9zA2rthSY6/YNH42+m0= X-Received: by 2002:a05:6870:a54a:b0:35b:7d80:b175 with SMTP id 586e51a60fabf-3c0f81feda8mr9491761fac.44.1760409533973; Mon, 13 Oct 2025 19:38:53 -0700 (PDT) Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20251011013312.20698-1-changfengnan@bytedance.com> In-Reply-To: From: Fengnan Chang Date: Tue, 14 Oct 2025 10:38:43 +0800 X-Gm-Features: AS18NWANM39t4RPcrlXYrv0Im7Lg9gLSnbpSWNZytM4PRJZOtaL1X_BkUQywkT4 Message-ID: Subject: Re: [External] Re: [PATCH] block: enable per-cpu bio cache by default To: Pavel Begunkov Cc: Christoph Hellwig , fengnan chang , axboe@kernel.dk, viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, willy@infradead.org, djwong@kernel.org, ritesh.list@gmail.com, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-DKIM: signer='bytedance.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: bytedance.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 Pavel Begunkov =E4=BA=8E2025=E5=B9=B410=E6=9C=8813= =E6=97=A5=E5=91=A8=E4=B8=80 21:30=E5=86=99=E9=81=93=EF=BC=9A > > On 10/13/25 13:58, Fengnan Chang wrote: > > Christoph Hellwig =E4=BA=8E2025=E5=B9=B410=E6=9C=88= 13=E6=97=A5=E5=91=A8=E4=B8=80 14:28=E5=86=99=E9=81=93=EF=BC=9A > >> > >> On Mon, Oct 13, 2025 at 01:42:47PM +0800, fengnan chang wrote: > >>>> Just set the req flag in the branch instead of unconditionally setti= ng > >>>> it and then clearing it. > >>> > >>> clearing this flag is necessary, because bio_alloc_clone will call th= is in > >>> boot stage, maybe the bs->cache of the new bio is not initialized yet= . > >> > >> Given that we're using the flag by default and setting it here, > >> bio_alloc_clone should not inherit it. In fact we should probably > >> figure out a way to remove it entirely, but if that is not possible > >> it should only be set when the cache was actually used. > > > > For now bio_alloc_clone will inherit all flag of source bio, IMO if onl= y not > > inherit REQ_ALLOC_CACHE, it's a little strange. > > The REQ_ALLOC_CACHE flag can not remove entirely. maybe we can > > modify like this: > > > > if (bs->cache && nr_vecs <=3D BIO_INLINE_VECS) { > > opf |=3D REQ_ALLOC_CACHE; > > bio =3D bio_alloc_percpu_cache(bdev, nr_vecs, opf, > > gfp_mask, bs); > > if (bio) > > return bio; > > /* > > * No cached bio available, bio returned below marked with > > * REQ_ALLOC_CACHE to participate in per-cpu alloc cache. > > */ > > } else > > opf &=3D ~REQ_ALLOC_CACHE; > > > >> > >>>>> + /* > >>>>> + * Even REQ_ALLOC_CACHE is enabled by default, we still need = this to > >>>>> + * mark bio is allocated by bio_alloc_bioset. > >>>>> + */ > >>>>> if (rq->cmd_flags & REQ_ALLOC_CACHE && (nr_vecs <=3D BIO_INL= INE_VECS)) { > >>>> > >>>> I can't really parse the comment, can you explain what you mean? > >>> > >>> This is to tell others that REQ_ALLOC_CACHE can't be deleted here, an= d > >>> that this flag > >>> serves other purposes here. > >> > >> So what can't it be deleted? > > > > blk_rq_map_bio_alloc use REQ_ALLOC_CACHE to tell whether to use > > bio_alloc_bioset or bio_kmalloc, I considered removing the flag in > > blk_rq_map_bio_alloc, but then there would have to be the introduction > > of a new flag like REQ_xx. So I keep this and comment. > > That can likely be made unconditional as well. Regardless of that, Agree, IMO we can remove bio_kmalloc in blk_rq_map_bio_alloc, just use bio_alloc_bioset. Do this in another patch maybe better ? > it can't be removed without additional changes because it's used to > avoid de-allocating into the pcpu cache requests that wasn't > allocated for it. i.e. > > if (bio->bi_opf & REQ_ALLOC_CACHE) > bio_put_percpu_cache(bio); > else > bio_free(bio); > > Without it under memory pressure you can end up in a situation > where bios are put into pcpu caches of other CPUs and can't be > reallocated by the current CPU, effectively loosing the mempool > forward progress guarantees. See: Thanks for your remind. > > commit 759aa12f19155fe4e4fb4740450b4aa4233b7d9f > Author: Pavel Begunkov > Date: Wed Nov 2 15:18:20 2022 +0000 > > bio: don't rob starving biosets of bios > > -- > Pavel Begunkov > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id EFZUCfn+7GgwOCwAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 13:30:33 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 13:30:33 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8IdE-0000000CEAS-3RQJ for hi@josie.lol; Mon, 13 Oct 2025 13:30:33 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id D4D3E4EB94C for ; Mon, 13 Oct 2025 13:30:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 323C2307AE0; Mon, 13 Oct 2025 13:30:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nKRLzPXZ" X-Original-To: io-uring@vger.kernel.org Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 525E2307AD2 for ; Mon, 13 Oct 2025 13:30:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760362227; cv=none; b=lrPZPFYCYk9Q9XgI0mIaob6y09YgqDtvdLXRsqZjzPVseQgee1Zt5gwP5yZF2/MraYsjWZgVQnfhppvnt1m9wTo8mxRNaO22V5u8DAyleD/yjxKpvpaxvszs/aWC83S3PCsb2+mbnOCjvjVXgdE/ekCRF/4UxY/mNWCaYV2cYkc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760362227; c=relaxed/simple; bh=pYKv/ZHAQal8b6v/icrawjp0xeugJB+Yhx7Gqtpqskc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=DXL3ADuaQgBKrsplrDOI5YcObF/si5doXNAstQNPqImUqV/VT2tb0Qk1g6y5604A3w/5joRxmcWsYa/DuUSwEhXTcmemzjhzcljjj4TwwcpjYIzo5Q1Uv82t5nTo7BNqXxvGeeZFje2OlO8wEOBLVfJ0p/0KxRd7M2HcmJ98eSk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nKRLzPXZ; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-46e34052bb7so50936185e9.2 for ; Mon, 13 Oct 2025 06:30:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760362224; x=1760967024; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=DZlmO7Er2VNfUt2lW8HD8G8xjeR52/0o/FyblKyrXi0=; b=nKRLzPXZnQf9ilLT2raNaKwPMG6B8Vee1uWqwMVCnAKqSukvQpx/qcvB400LvbTRYx fDZe5SHGtw9N/OmQD1fp+c20mNiIoCa7S0RTxayO7va4bk0AYZIOyHwbOj4vNB4tb9lN bDY5zZQosZZ3k6ApeKSFrEUwzob5gRGlEPeWCe+hfRjO2Q4+2xbXi8K5lIkkNpIQxvYy V8OGvKAJ6FdFO0bcqmacw5NecjeQUrtEPOZoUl8g/Buiy3JLKQg1IuddCiXv65nA1IlB jsEr6eXzXiqQ7TnC3MZw/sBS5/L3XBvLIZRHM2jk0DCOxNJHcyWKzuTSIlA8saTZEdtO vVeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760362224; x=1760967024; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DZlmO7Er2VNfUt2lW8HD8G8xjeR52/0o/FyblKyrXi0=; b=uKyXjjlgcMIVXMLdDelio03oVbemiTuSjWWepeKvS0bH073GAyCkxhbWqi3vt3KXRb ygfmWOCTdvCvCQjz1/aH3U9cXWmTZQi+4qQHyxpvp3FxQpyZQyaHGkNGTyNMf7QHr82X Kl4y9MMyeWZyYv4qzJnaD7TEDR6RfsZNDI91AYFTGCS4fhxvlVrlbtACCKjZqqMArCsX r/V/vH2liOszIX+uzdzlH+7Dyms4gCD4mUKTF06VIaQZXgjKB5JcsTf+eERkgAJqJCEW bQkyi2BxJCFs84n9NhjXuqLh07G4kkMvHhLCXSlO0VeO81JmCbK0CRCfSN+kueR38Bap SEKA== X-Forwarded-Encrypted: i=1; AJvYcCXU2LK5mjriweOxI/G3EB+gtpPGBXfFwnGkH67LTMRSAnpDvlCHmuuF+GlQRIWRr+FZ1e5tLMFNyw==@vger.kernel.org X-Gm-Message-State: AOJu0YxZuPFqy0rAOLoA3PusHuloYx7uzToGhI0VmVVE1a9FcP5twoGz bBx05nxQoUNqME5zC3w3eGEVzX4QMe00hB+IcNssxq3dqzIAUiMTdVQn X-Gm-Gg: ASbGncv9AR+RNikMkm1/FFNghJqWjP2GlnpC/KRHr0oAiBUdxVyq6uvEM7WX+VC65aB lOufCYJuMb3HMP5mFdHsdLGyUJ9hilDogQ4Idrov5Ly8j7VY/RujnbxJgu1pl2wp996rpFQw+TG 4Ln98r1hAQ6JsgoF+LIk1x78xA1ILkdWIGTQMBbmc1jb6VtmRtygZRf5AP0Nr+/7TWRolXt4a9R 0xhJKhztR7uHNHtY+e+bjoxQZrnFB8pUQE/hi4iL+sVvX5TGa3detWL4WmHXnQcGd0Gv6GO74nq 44iwhMAi8HNYPjmI8J1CvLN6fN5K4dQ+ms0vDpeILJbLU8i1ae56noqaLbG9ZB+Lwn4HOQe/nXc /QyBuqb+HGW3cgyzr5VEkWlexdsoiVSrO2LZNIjAURmovlZ+8q+M45lDeWsbwpJ0etRr4Ioxqei DkqFLHhsnl X-Google-Smtp-Source: AGHT+IFb8vtBJitNnjBlDbVIUCm2gATTzzIuI7S2acOd2FoeBSuIxAzk1vmdrirRWyHwbC1aiC5zwg== X-Received: by 2002:a05:600c:6092:b0:45d:e28c:8741 with SMTP id 5b1f17b1804b1-46fa9b02e5amr148223315e9.29.1760362223296; Mon, 13 Oct 2025 06:30:23 -0700 (PDT) Received: from ?IPV6:2620:10d:c096:325:77fd:1068:74c8:af87? ([2620:10d:c092:600::1:eb09]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-46fb49c3e49sm185108555e9.16.2025.10.13.06.30.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Oct 2025 06:30:22 -0700 (PDT) Message-ID: Date: Mon, 13 Oct 2025 14:31:32 +0100 Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [External] Re: [PATCH] block: enable per-cpu bio cache by default To: Fengnan Chang , Christoph Hellwig Cc: fengnan chang , axboe@kernel.dk, viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, willy@infradead.org, djwong@kernel.org, ritesh.list@gmail.com, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org References: <20251011013312.20698-1-changfengnan@bytedance.com> Content-Language: en-US From: Pavel Begunkov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [asml.silence[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On 10/13/25 13:58, Fengnan Chang wrote: > Christoph Hellwig 于2025年10月13日周一 14:28写道: >> >> On Mon, Oct 13, 2025 at 01:42:47PM +0800, fengnan chang wrote: >>>> Just set the req flag in the branch instead of unconditionally setting >>>> it and then clearing it. >>> >>> clearing this flag is necessary, because bio_alloc_clone will call this in >>> boot stage, maybe the bs->cache of the new bio is not initialized yet. >> >> Given that we're using the flag by default and setting it here, >> bio_alloc_clone should not inherit it. In fact we should probably >> figure out a way to remove it entirely, but if that is not possible >> it should only be set when the cache was actually used. > > For now bio_alloc_clone will inherit all flag of source bio, IMO if only not > inherit REQ_ALLOC_CACHE, it's a little strange. > The REQ_ALLOC_CACHE flag can not remove entirely. maybe we can > modify like this: > > if (bs->cache && nr_vecs <= BIO_INLINE_VECS) { > opf |= REQ_ALLOC_CACHE; > bio = bio_alloc_percpu_cache(bdev, nr_vecs, opf, > gfp_mask, bs); > if (bio) > return bio; > /* > * No cached bio available, bio returned below marked with > * REQ_ALLOC_CACHE to participate in per-cpu alloc cache. > */ > } else > opf &= ~REQ_ALLOC_CACHE; > >> >>>>> + /* >>>>> + * Even REQ_ALLOC_CACHE is enabled by default, we still need this to >>>>> + * mark bio is allocated by bio_alloc_bioset. >>>>> + */ >>>>> if (rq->cmd_flags & REQ_ALLOC_CACHE && (nr_vecs <= BIO_INLINE_VECS)) { >>>> >>>> I can't really parse the comment, can you explain what you mean? >>> >>> This is to tell others that REQ_ALLOC_CACHE can't be deleted here, and >>> that this flag >>> serves other purposes here. >> >> So what can't it be deleted? > > blk_rq_map_bio_alloc use REQ_ALLOC_CACHE to tell whether to use > bio_alloc_bioset or bio_kmalloc, I considered removing the flag in > blk_rq_map_bio_alloc, but then there would have to be the introduction > of a new flag like REQ_xx. So I keep this and comment. That can likely be made unconditional as well. Regardless of that, it can't be removed without additional changes because it's used to avoid de-allocating into the pcpu cache requests that wasn't allocated for it. i.e. if (bio->bi_opf & REQ_ALLOC_CACHE) bio_put_percpu_cache(bio); else bio_free(bio); Without it under memory pressure you can end up in a situation where bios are put into pcpu caches of other CPUs and can't be reallocated by the current CPU, effectively loosing the mempool forward progress guarantees. See: commit 759aa12f19155fe4e4fb4740450b4aa4233b7d9f Author: Pavel Begunkov Date: Wed Nov 2 15:18:20 2022 +0000 bio: don't rob starving biosets of bios -- Pavel Begunkov From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id SHQMMp/37Gig/yEAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 12:59:11 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 12:59:11 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8I8t-0000000BAJH-19B5 for hi@josie.lol; Mon, 13 Oct 2025 12:59:11 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7A4243C08DC for ; Mon, 13 Oct 2025 12:59:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2A63326AA94; Mon, 13 Oct 2025 12:59:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="B9UyH05f" X-Original-To: io-uring@vger.kernel.org Received: from mail-oa1-f49.google.com (mail-oa1-f49.google.com [209.85.160.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37132269D06 for ; Mon, 13 Oct 2025 12:59:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760360349; cv=none; b=hTsNoKphkGfHY4rHZubZVBJOJYnf/N2/Fu1/HJiWSE4ADSEYgwibPFJwCZK0BuLZro+NXwssmRZVOTVpzlkGrJV7eB7JzhH4MWnHFV6W5UmIi8wsxPygH7HLkAzDWoDRuzjcT2AtnAfwc8OnLc8ZU+4jKB6WxA9NENzzKpL8d/0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760360349; c=relaxed/simple; bh=D6V3XPkrc+t2idQmAkRSOk7iDPs7p8w0xsyna0/EAms=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Edl5M/ZveY0bNR6czCsLtXDTShk5U4QhWoRwmUoLEWC0NqG9d/s8qcBZp0gKv9ntcYbG+9MhZaq3x6Hgq+XXWcI42frlGY8mUnS0dytfOba6f1DQ64b95Nq7E0gcqn6p/J3tmxe1CuzJFvUmT2p8kcH8Q1teldnRJzZf7+k/DII= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=B9UyH05f; arc=none smtp.client-ip=209.85.160.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Received: by mail-oa1-f49.google.com with SMTP id 586e51a60fabf-330d1565844so2567384fac.1 for ; Mon, 13 Oct 2025 05:59:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1760360345; x=1760965145; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=9Wmypoq4JusPQtINuz1Vuv55d8t7TPWrzMFDko8wjps=; b=B9UyH05foBQyFo3GAqVmomH33i32hZfsbauxq2TxSOZXmKGJfh08jxhtDuYctqirTi +znbj5YMDykLDsosYTPWEgW+T2R4d6Kpu26CrxcrpHuyKc5hlq7p7XABUmzfVxyE3HYo YjQqvWGD9A3KL6wQKE9NuFhi9ZCiLWGbmax+NtRk0Tm7h66+iNefKK/1pCYfUljJl+yQ nzCT1p1+4OVJLh+B1DSyY9lOk948JiO4EpJ5btrqqtrgc+zcetIN0DjA5BT0I8BaF99r atybbxItM8SPjnbn8hiNTQVdD39QA2GOdN/PCu/Bt0M9eOZ7f0xTDW16UaqhNBGmwEdC z/qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760360345; x=1760965145; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9Wmypoq4JusPQtINuz1Vuv55d8t7TPWrzMFDko8wjps=; b=wTwxgE4SpFjIGG5duSJMDbBh4eY3NGL+6RGdMzCv0ty3szx3TII55Lib37RD1YyuhA BWF7YlaqRemPs4w3B7Z8fncz1wvDYNovk3FJWXu2pJir5pfddIch3q4FCNNXFJ0ODy36 ajFQwnFy+4iuf/D6m6mUt710bX9B0gsi2juR2nu2Pj8S+778y18CHr50XQQioHxTj7Pr 7MD2VY6md6WXn4P8K5latz8L+C0meRjK9Dcj9xU16UnKXtHfuZ3PWQa/Z7ICv6aaND2t 2hIPUvslTQyYr2v3YqQE8tLZkq1njD/UHA61rg6ibMJsWmg7sXMt8CMM3AByeaBlF2wv fehw== X-Forwarded-Encrypted: i=1; AJvYcCUJHK7Pla8zbTXEBdIreiT+FMqNkHUh7ZxrSjsNGZTRfhWQELFnZlQ+/apgbYQntv/yYNPPaQ+irA==@vger.kernel.org X-Gm-Message-State: AOJu0YzXyDvJL/Jne4KUT/ToGdFz4uBNO15Ix08fSuSQGouXaw+lAcdV UD/fy8uLTPCCCQ9m9jljDQzIQZUJ6xk2wqtQFU6r/pNgjjY946I3MRAUJPpaiTYwgSje2pKh69O jR7RYKH6sdsbLfYTr2BPKMNPijnPWLGAUSzIAz/uv4w== X-Gm-Gg: ASbGncsKSchlbKgfahAa0oTyPJXpRSlhkHMrnCq0lduguIKEe5F0L4Va6WD3mjvuJGS DR88xBVKiz/fJk0odpCHz1J550yKUREKse6hd52C6IejASuEPSjSFJqKSbedEJeBGH0W/Ux9fr4 mbvuDGjAr569X2o3Bo6i08ASl6FU2rpiHmnfI7FWGbhCwREPgrULKGyqQvb3VjS+uHEHxmzLLVB Bklr65F4TcbuGi7NBlreD9cdnLR86buWE5IEc9VNaIJ7w== X-Google-Smtp-Source: AGHT+IFcgfB7Wf1FZ1oK1mDKCUiDJpUURtVox8EHig27s8X9dUwwKIMVBBoJvN74OlkrVqbewuUEWyvLA9j7WIpDFWo= X-Received: by 2002:a05:6870:5490:b0:395:11a1:2a5 with SMTP id 586e51a60fabf-3c0f68f3ed7mr8576313fac.19.1760360344992; Mon, 13 Oct 2025 05:59:04 -0700 (PDT) Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20251011013312.20698-1-changfengnan@bytedance.com> In-Reply-To: From: Fengnan Chang Date: Mon, 13 Oct 2025 20:58:54 +0800 X-Gm-Features: AS18NWDyQf8Y1FBCeSc2-tQU2iORMO74jotl63VadojDvfzhepmbn3llIRtG9jI Message-ID: Subject: Re: [External] Re: [PATCH] block: enable per-cpu bio cache by default To: Christoph Hellwig Cc: fengnan chang , axboe@kernel.dk, viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, asml.silence@gmail.com, willy@infradead.org, djwong@kernel.org, ritesh.list@gmail.com, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-DKIM: signer='bytedance.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: bytedance.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 Christoph Hellwig =E4=BA=8E2025=E5=B9=B410=E6=9C=8813= =E6=97=A5=E5=91=A8=E4=B8=80 14:28=E5=86=99=E9=81=93=EF=BC=9A > > On Mon, Oct 13, 2025 at 01:42:47PM +0800, fengnan chang wrote: > > > Just set the req flag in the branch instead of unconditionally settin= g > > > it and then clearing it. > > > > clearing this flag is necessary, because bio_alloc_clone will call this= in > > boot stage, maybe the bs->cache of the new bio is not initialized yet. > > Given that we're using the flag by default and setting it here, > bio_alloc_clone should not inherit it. In fact we should probably > figure out a way to remove it entirely, but if that is not possible > it should only be set when the cache was actually used. For now bio_alloc_clone will inherit all flag of source bio, IMO if only no= t inherit REQ_ALLOC_CACHE, it's a little strange. The REQ_ALLOC_CACHE flag can not remove entirely. maybe we can modify like this: if (bs->cache && nr_vecs <=3D BIO_INLINE_VECS) { opf |=3D REQ_ALLOC_CACHE; bio =3D bio_alloc_percpu_cache(bdev, nr_vecs, opf, gfp_mask, bs); if (bio) return bio; /* * No cached bio available, bio returned below marked with * REQ_ALLOC_CACHE to participate in per-cpu alloc cache. */ } else opf &=3D ~REQ_ALLOC_CACHE; > > > > > + /* > > > > + * Even REQ_ALLOC_CACHE is enabled by default, we still need = this to > > > > + * mark bio is allocated by bio_alloc_bioset. > > > > + */ > > > > if (rq->cmd_flags & REQ_ALLOC_CACHE && (nr_vecs <=3D BIO_INLI= NE_VECS)) { > > > > > > I can't really parse the comment, can you explain what you mean? > > > > This is to tell others that REQ_ALLOC_CACHE can't be deleted here, and > > that this flag > > serves other purposes here. > > So what can't it be deleted? blk_rq_map_bio_alloc use REQ_ALLOC_CACHE to tell whether to use bio_alloc_bioset or bio_kmalloc, I considered removing the flag in blk_rq_map_bio_alloc, but then there would have to be the introduction of a new flag like REQ_xx. So I keep this and comment. > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id 2DQZKiOc7GinnjgAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 06:28:51 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 06:28:51 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8C39-0000000FZjd-0SqU for hi@josie.lol; Mon, 13 Oct 2025 06:28:51 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0DB393A97CB for ; Mon, 13 Oct 2025 06:28:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 055642E22BF; Mon, 13 Oct 2025 06:28:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="JTEuXZ4R" X-Original-To: io-uring@vger.kernel.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 5783F2DD60F; Mon, 13 Oct 2025 06:28:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760336893; cv=none; b=otRCfQm0NHMzLgP/i27B9F93QU+gKsOKt9u6FAaAaG+9b0NkZ2w5NgXxcHMVqkhc+KgSRj5RZyTVndRI7m8jFFOG4+C1AYZMpuV/zEnVGqIXFKn8OEcTf7oPdVfAZKVmZ3nGxyu8lyMagBw3E3A46FjIlmj/ber1HRt9/9vxkF8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760336893; c=relaxed/simple; bh=t2wTMKKO4ssVUXq+IB+NkSmcXWByEhkt844Hz0StKR8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rpaBK+RRmf3qwmkvNlk6TQY2KPzSsLR6EVAvfWM5R45D8ZpMgAt2gPxUsQkEuf1GdkyFEEhStnIGl7+OrPUGtrxi+h7m/XeH90TqM0qT25ZuHC8YFU0jBMKK0k3Zs6z7SpfdEjeHJUOOY6+bBvALNGXlJNEpZHxFhlFXH89H+e4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=JTEuXZ4R; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=C5b1JVWJxyJY0P7iS2qQASAGD/AgiaXpXDvD2N6N4UA=; b=JTEuXZ4RFAGkc0gsO+ULGdXAxB 4Gx3OGa6t3dH3J01RvZmdGknWruNr/HfAPaQn+s5SIuXjtb99xZq5BHgYjdMNNPCcON1LsnmaLm4S Ynt4JevQs/ezaTQGWYq8pJ3BMIl0kO7Atz2MX+1NWFsytR2rTBfNG1ndRhTIYcPVClZ4lSW7KKVWB Mc+ogxk7gg2VNwGZhaXhhei0tTOuiYK0uWof2X+21zxZpaMlkqzt0QMdDAmrNauDtgMUVV8xBPZ+D TGrSERWjpf5BRlnDQsxKKJvJU48NSAawuCquZugaze8xjGfLsYlNhlCK6ZCLP0SU8PHbOj5kuIyxC 5WrIYbnA==; Received: from hch by bombadil.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1v8C2S-0000000COBz-3IUH; Mon, 13 Oct 2025 06:28:08 +0000 Date: Sun, 12 Oct 2025 23:28:08 -0700 From: Christoph Hellwig To: fengnan chang Cc: Christoph Hellwig , Fengnan Chang , axboe@kernel.dk, viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, asml.silence@gmail.com, willy@infradead.org, djwong@kernel.org, ritesh.list@gmail.com, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org Subject: Re: [PATCH] block: enable per-cpu bio cache by default Message-ID: References: <20251011013312.20698-1-changfengnan@bytedance.com> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-DKIM: signer='infradead.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: infradead.org] -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On Mon, Oct 13, 2025 at 01:42:47PM +0800, fengnan chang wrote: > > Just set the req flag in the branch instead of unconditionally setting > > it and then clearing it. > > clearing this flag is necessary, because bio_alloc_clone will call this in > boot stage, maybe the bs->cache of the new bio is not initialized yet. Given that we're using the flag by default and setting it here, bio_alloc_clone should not inherit it. In fact we should probably figure out a way to remove it entirely, but if that is not possible it should only be set when the cache was actually used. > > > + /* > > > + * Even REQ_ALLOC_CACHE is enabled by default, we still need this to > > > + * mark bio is allocated by bio_alloc_bioset. > > > + */ > > > if (rq->cmd_flags & REQ_ALLOC_CACHE && (nr_vecs <= BIO_INLINE_VECS)) { > > > > I can't really parse the comment, can you explain what you mean? > > This is to tell others that REQ_ALLOC_CACHE can't be deleted here, and > that this flag > serves other purposes here. So what can't it be deleted? From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id AOU6K82R7Gg21zEAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 05:44:45 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 05:44:45 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8BMT-0000000E5dF-1i7m for hi@josie.lol; Mon, 13 Oct 2025 05:44:45 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3FA5D3B2ED7 for ; Mon, 13 Oct 2025 05:44:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B69C2DC776; Mon, 13 Oct 2025 05:44:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Y+I7ZrtE" X-Original-To: io-uring@vger.kernel.org Received: from mail-vk1-f179.google.com (mail-vk1-f179.google.com [209.85.221.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51FAA2DC76E for ; Mon, 13 Oct 2025 05:44:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760334272; cv=none; b=YWddYd1XFMvQdmXLoLT/gBxIltyMjOVxf5xDSon2oKR+D1uMFft6QsGhUmRLCPwJaXJaCcukTk+MvlwJSQG4TcJJfpz5fmO5iM082PU0fPAcV1/r0TZ2YqkEL1m1jeiFpwqdFPCUMcIXUqtgG6OY5Le3sdeNkiDoO/f2v8gOOoU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760334272; c=relaxed/simple; bh=Vluz9ytPQeMtlO7P9ORKtagTdZgZUvCkj7WhJdLaLOw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=GdTEhYHU7TQVQUDjgK34Dlksr47bzwh379MUAX3EK+7uF6KLyJlXOASgpnAWOydpfCKAArUCQbX3bb9Yhik73lQS0mxMqVIhbSU8lxOz+iE3qowecv7tQ0484MYjkmYjlRDZ2wfAjEEWuH2DxECOqXZYP3oiAjCzznZUU7XVgDM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Y+I7ZrtE; arc=none smtp.client-ip=209.85.221.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-vk1-f179.google.com with SMTP id 71dfb90a1353d-54b27d51ef7so610522e0c.1 for ; Sun, 12 Oct 2025 22:44:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760334270; x=1760939070; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=PfZ0cjDYVK5lhFzxXW1zOC477aQ4q/mTU1VD2TvA1nQ=; b=Y+I7ZrtEUyrbBVyxb/pwVHSPm/NUjdcUN7p2QIOR2Gc76JioaCNAHT0DpUo4aQJBuh 6U3XRCAD4pT22cE0CZIrWjFoF94AIvPb3sECA4AIwObH5az4F4oBgbgRjAHJ04DUSgIN cgJWnI10SIM9wQD8DIf6C2A8ZivTesUbfjQGHDwE2Xta85NwyTJaH02gd6HZZnUc2Iqh /b9tlDquyWgeVVEOknwdr29PWPcBZODGzVtZOZKagmwsoSyx+ITO/MQ4LKrvzqej7/Nv t+me5XWphNc1k+F81d5qH4Z8A1bOgpxWdzw1oKqHAm1sQO0Uy4SnSje7hng2iB1YlAnS JpCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760334270; x=1760939070; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PfZ0cjDYVK5lhFzxXW1zOC477aQ4q/mTU1VD2TvA1nQ=; b=Hx19IVBHCUeABgpsi2MQWHihn5a6QzeeSSxfBwZvxjpAB/9WtKCJyjauB5SQIDWaFL 7hbGNaCr7BVk5FLAyVuWPtDHI7QkLcG7ZRyJvmv5jwt1qEqNrUdhQR8xCZWhQjv/lMy+ TewN85Tgg18B7L+1Od/nIkcbWSAu9HG6aHPMDmj9cl2YhBSycUi0shdxR28FZvMYgNuW BYD+u2VIxg3Vo096qI3yYoFhqeOFzJsTTluO0hmj77zmknt0s8uaIzvic0va7UAdTDXh c6QqVMKc/Vw2bkL3asBBmMmqlt+JUZn9m4Vu9UoVL1RfFcycMsd+TvVHVWMDMvNSZB8R VqtA== X-Forwarded-Encrypted: i=1; AJvYcCW40gzzS802gC2fScjxOIWPBi++CroxJQaHgP2tMLmmWAY2FxW7Vu4PUnbnOT+EjqKHa2Ky8OumSw==@vger.kernel.org X-Gm-Message-State: AOJu0YxVm6WdJ2bXwZ1Kz78iIO0+0qdl+hkYsWczXwzyGCp1Zz3Eb8u6 onpLgPqp5FIseB2Vc8W6aUxkg4tPCtmOsO8tVl2+XzpKNKcDbS4Bgp753iILXhveMwdbGi/Sy5J 4JYQZEa/VDRzVXL/ooDS6q+nGgjYx9Nk= X-Gm-Gg: ASbGncsUB3ws3mGhvtl1wpIfGB4u/eCYNoIi6NicP0oGR/Bp/3XRQvpcPwkiP1WRngA DLsEJbnRgqCVSqN+V/lIa+oGSpgtxEQ7IU/snL+PAAfN0qNU09IBynoGCrY+JPIUH3iFz0H5ypX SGUKQAQNLRrHTNIg0/NRbXsD7i6eSG4s3027gK0toPRFjtHmXLnAxmCqypido0yQmWU1srZoIsq qseQoHJGzIsOVYwc+f78ru9xX4= X-Google-Smtp-Source: AGHT+IHpSmXJAORlFvfBjiO5EpZknUsClCESfr6miv9ORXUHlNjIb1jckJtzwj7e3Gce86ucBxKeE0hLKTbq4g4SBL8= X-Received: by 2002:a67:e009:0:10b0:5d5:f437:92d5 with SMTP id ada2fe7eead31-5d5f43792efmr3865770137.3.1760334270191; Sun, 12 Oct 2025 22:44:30 -0700 (PDT) Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20251011013312.20698-1-changfengnan@bytedance.com> In-Reply-To: From: fengnan chang Date: Mon, 13 Oct 2025 13:44:19 +0800 X-Gm-Features: AS18NWD8kq6UQsDDGG0qKmrz3bfZhv6wKElSNkMZ019t6wf6DXrrEBmZE82HmfY Message-ID: Subject: Re: [PATCH] block: enable per-cpu bio cache by default To: Ming Lei Cc: Fengnan Chang , axboe@kernel.dk, viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, asml.silence@gmail.com, willy@infradead.org, djwong@kernel.org, hch@infradead.org, ritesh.list@gmail.com, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [fengnanchang[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On Mon, Oct 13, 2025 at 1:19=E2=80=AFPM Ming Lei wrot= e: > > On Sat, Oct 11, 2025 at 09:33:12AM +0800, Fengnan Chang wrote: > > Per cpu bio cache was only used in the io_uring + raw block device, > > after commit 12e4e8c7ab59 ("io_uring/rw: enable bio caches for IRQ > > rw"), bio_put is safe for task and irq context, bio_alloc_bioset is > > safe for task context and no one calls in irq context, so we can enable > > per cpu bio cache by default. > > > > Benchmarked with t/io_uring and ext4+nvme: > > taskset -c 6 /root/fio/t/io_uring -p0 -d128 -b4096 -s1 -c1 -F1 -B1 -R1 > > -X1 -n1 -P1 /mnt/testfile > > base IOPS is 562K, patch IOPS is 574K. The CPU usage of bio_alloc_biose= t > > decrease from 1.42% to 1.22%. > > > > The worst case is allocate bio in CPU A but free in CPU B, still use > > t/io_uring and ext4+nvme: > > base IOPS is 648K, patch IOPS is 647K. > > Just be curious, how do you run the remote bio free test? If the nvme is = 1:1 > mapping, you may not trigger it. I modified the nvme driver, reduce the number of queues. > > BTW, ublk has this kind of remote bio free trouble, but not see IOPS drop > with this patch. > > The patch itself looks fine for me. > > > Thanks, > Ming > > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id eMsZB2iR7GjcRSsAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 05:43:04 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 05:43:04 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8BKp-0000000E2JV-3mWm for hi@josie.lol; Mon, 13 Oct 2025 05:43:04 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 09D4E4E270F for ; Mon, 13 Oct 2025 05:43:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 622D82DC35A; Mon, 13 Oct 2025 05:43:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IWCG7q2p" X-Original-To: io-uring@vger.kernel.org Received: from mail-vk1-f170.google.com (mail-vk1-f170.google.com [209.85.221.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3F4D232785 for ; Mon, 13 Oct 2025 05:42:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760334181; cv=none; b=E7F4+R2RZtlMpk9aDH/47WgYNpkBX3yWpcEvCq6P68TUx1seeFpb98qcEYlP9kdNoDxD2gZOtQ+asD81SwpacoQ1lffqzQZP6nq0KW2Qpq3NGm3LBuW8X1u3X9eEW+9hIFO+gVFiKBPKMuLBraWCDhA7JT5OZTU+c2jEi8lkofs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760334181; c=relaxed/simple; bh=LkiHDxUpll20Mzzyjyp6GAradkAWV81/VhYmzsLwOLs=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=VZevzshsMu8vLuWNNNmXwIYtUhjQkCXA52GLByIQnYDLHyDABQ3Y8X9ShjxwykkwWfyhl6bdF+sFsO/B90yfAUIby8WIRgTAOaLPIEWvEKalF+FKoiT8QMwHl3zcCysPuu1eUPxmzGSBzRmXo5gg1rP/4JKkLSie218S+0ZqeiA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IWCG7q2p; arc=none smtp.client-ip=209.85.221.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-vk1-f170.google.com with SMTP id 71dfb90a1353d-54a8f6a2d80so1209404e0c.3 for ; Sun, 12 Oct 2025 22:42:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760334179; x=1760938979; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=rFw8GX7he7wIYguaN9JzvQNXMrk3Z90u5aRFTT7c2yU=; b=IWCG7q2p7ncp3CeE2O5Slzpe2mNztlvZhmi9ntpDYMpxLGBvuzLRHSH+ncBuJYaKD+ jzc6ucI6ohY6D/Iica3jWOpZd+lh0UGTNdAzv30lo68Fos9U3jAC+xcC2jHVIp/qaQH4 EKmTWoWaxx1XGMIAKWpSuyQBq+FQggTp+T2YRLmhhPAC1WDFsCEaklEKKoc3gnGZXfyM VxHlzrORf8boipLV1lThncDGuIYq55L9vVWVlvLFid8Y81xCaMzjT7xFu169zTPqSlYy ot8bM/NL0/yxTgbiqrefFX17lVANYxojBoKcYczeWjOU2o26WB8fcrBiEP6ApN2kkmmZ L4Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760334179; x=1760938979; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rFw8GX7he7wIYguaN9JzvQNXMrk3Z90u5aRFTT7c2yU=; b=FvH7TFATBPm2w3HEl5ytcVQXxhV+DTxFpJqs2EwNAIvu/y0zIIkuKMD6PUtlXvNlZr pKP3qxdh5qhKIP7f1nJKdbxNU9EFxQZ5cqjrr7it8wuVVA4e+y6NQU7P/MZuH+7n6FxY +dWSvby/J3HrXe1uC4F664I1jkQwAciw74P5Axq+/SvIG2+Hbv2f4WThdTY0K8QH9pC5 xXJqtBvar6DgsN1JJI/Kv625WxvyjGEmufoB/Dv54C4FwG+cWaEmoOhyMrvTQ96ke+Lb qOw7JfHVSsoUItnEIx/2ksZANtyYH8mpRmDNQyQaBLuYbvv6Lwhvdcr6pgCrl89usaDf 2ocw== X-Forwarded-Encrypted: i=1; AJvYcCXUW3e1pxrbLHwKP1PMoeVYO1CLREjc0A/8R2rdBWqpGb/wbTkxKbsbXkPV7SLQKHflkrCvYZ8qGA==@vger.kernel.org X-Gm-Message-State: AOJu0YyxzvBh0CD42wwM/WGyC2Jf/8WooeCZPVX9Du7mgPadsdiERfGU 5MHK0tFRYs5jtW6AG1pyDXizndPT5iHiVDwYRD8RB/Sfh4Xj0qtMov9HW0EnEn2dmffAUvwO1Ee Nkc0ZM/RMeZE6MiVpOzpx7C1ZoKInmPI= X-Gm-Gg: ASbGncvRxpg81QmLX+n3Pl7ccJ3avAb2aR6UFrq7L0bG6saPscwwDGvrS/BlP1BSyGZ Qz9pm95sAk57mvI5OB7CkHje+rMXFkyvfdqbYXtqkePjh5ZFh33gHuZkgdydnT8fVHRYMbnwkMG Cimmzdxz1McZuGl7vnwBgdI5ySZe4D7nI2dyPA/HYiOOpcIYwlHdccekacqJ6tfxtqlIcDcHs/E BPKI0fx6KiK+56VXzErrq9JG8BS4JZOhZMEHw== X-Google-Smtp-Source: AGHT+IE2pzpIXFUlQnxpSAUJmDsWbuHYPNEdEfC1GOsG6qkn6Ggw30mR6TSMqPTmSaIF0L9e6DD5b5ldfGpQurArkk4= X-Received: by 2002:a05:6122:91b:b0:545:ef3e:2f94 with SMTP id 71dfb90a1353d-554b8aa8d4fmr6241006e0c.1.1760334178612; Sun, 12 Oct 2025 22:42:58 -0700 (PDT) Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20251011013312.20698-1-changfengnan@bytedance.com> In-Reply-To: From: fengnan chang Date: Mon, 13 Oct 2025 13:42:47 +0800 X-Gm-Features: AS18NWBq65kKS67xgSwyGWf422mFA-TjXvUExYQYDBZ5JznD-_4en1JwPHXcFWo Message-ID: Subject: Re: [PATCH] block: enable per-cpu bio cache by default To: Christoph Hellwig Cc: Fengnan Chang , axboe@kernel.dk, viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, asml.silence@gmail.com, willy@infradead.org, djwong@kernel.org, ritesh.list@gmail.com, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [fengnanchang[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On Mon, Oct 13, 2025 at 11:25=E2=80=AFAM Christoph Hellwig wrote: > > On Sat, Oct 11, 2025 at 09:33:12AM +0800, Fengnan Chang wrote: > > + opf |=3D REQ_ALLOC_CACHE; > > + if (bs->cache && nr_vecs <=3D BIO_INLINE_VECS) { > > + bio =3D bio_alloc_percpu_cache(bdev, nr_vecs, opf, > > + gfp_mask, bs); > > + if (bio) > > + return bio; > > + /* > > + * No cached bio available, bio returned below marked wit= h > > + * REQ_ALLOC_CACHE to participate in per-cpu alloc cache. > > + */ > > + } else > > > + opf &=3D ~REQ_ALLOC_CACHE; > > Just set the req flag in the branch instead of unconditionally setting > it and then clearing it. clearing this flag is necessary, because bio_alloc_clone will call this in boot stage, maybe the bs->cache of the new bio is not initialized yet. > > > + /* > > + * Even REQ_ALLOC_CACHE is enabled by default, we still need this= to > > + * mark bio is allocated by bio_alloc_bioset. > > + */ > > if (rq->cmd_flags & REQ_ALLOC_CACHE && (nr_vecs <=3D BIO_INLINE_V= ECS)) { > > I can't really parse the comment, can you explain what you mean? This is to tell others that REQ_ALLOC_CACHE can't be deleted here, and that this flag serves other purposes here. > > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id GCkFMsiL7GiNRCsAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 05:19:04 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 05:19:04 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8Axc-0000000DJmW-2W1T for hi@josie.lol; Mon, 13 Oct 2025 05:19:04 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id D5ECC4E8042 for ; Mon, 13 Oct 2025 05:19:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B4922C21CD; Mon, 13 Oct 2025 05:18:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hCqv4Qla" X-Original-To: io-uring@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 CDA142C1780 for ; Mon, 13 Oct 2025 05:18:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760332715; cv=none; b=d5q6Op0aldyGeQwm8ZmRScuH4aTrZvNhthjTJmgDpua+7kTlKNP/kW69KODpghMJvAloIgfDDTjVd3K5TwhpTWAo8U40tC7ebpi0Npk/RMvO1R/+ZFVGJbsZ4n1adHztqOqvabxfLv/AZycy/Z0OqmMy36lxL5A4/sVrB+KL9so= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760332715; c=relaxed/simple; bh=qfn0bPiNwvIjf0wOjVBZvcae1QUN/o0t00Y6ze89QOA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qsfkrigHhGyCaMtIzv0GGzvvtT3q7Jgl5cNpZENaSkN0qcfxqM74pDLFqz2nFZwjbp8KqE4+Zt5nqW9hWeQFZgu4V4LaO5hE7IkWhVPJrkfOgN4tmNLOxDWF80pyDbzpfZqYkiLR09zdYxlDKAcw5pACC0iUrpABHJpQtNFKXKE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=hCqv4Qla; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1760332712; 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=i+gJL5z0jaVBdvej6tFxwAUlCI1uAUXuFZV5Hlu4fb0=; b=hCqv4Qlabiz9A5JN7xswEkmi+KB27Y+3PvaNdDpmZVu/leRg/LshB0emcohB1Uvsnt00hs 35edT+EBM7feGuuRfUdYfevxCmXu2EYK5zvwHl3uyey23mkfpmaDUyPSG8JYzFr4/u6RYo nUg7HD9iP8RCycYDftvHb4FXkiNmYG8= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-75-9uIRZvh6NROXMUwVq_2Ztw-1; Mon, 13 Oct 2025 01:18:29 -0400 X-MC-Unique: 9uIRZvh6NROXMUwVq_2Ztw-1 X-Mimecast-MFC-AGG-ID: 9uIRZvh6NROXMUwVq_2Ztw_1760332707 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id ED6271800447; Mon, 13 Oct 2025 05:18:25 +0000 (UTC) Received: from fedora (unknown [10.72.120.21]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7725E1800452; Mon, 13 Oct 2025 05:18:17 +0000 (UTC) Date: Mon, 13 Oct 2025 13:18:12 +0800 From: Ming Lei To: Fengnan Chang Cc: axboe@kernel.dk, viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, asml.silence@gmail.com, willy@infradead.org, djwong@kernel.org, hch@infradead.org, ritesh.list@gmail.com, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org Subject: Re: [PATCH] block: enable per-cpu bio cache by default Message-ID: References: <20251011013312.20698-1-changfengnan@bytedance.com> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251011013312.20698-1-changfengnan@bytedance.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-DKIM: signer='redhat.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: 4 On Sat, Oct 11, 2025 at 09:33:12AM +0800, Fengnan Chang wrote: > Per cpu bio cache was only used in the io_uring + raw block device, > after commit 12e4e8c7ab59 ("io_uring/rw: enable bio caches for IRQ > rw"), bio_put is safe for task and irq context, bio_alloc_bioset is > safe for task context and no one calls in irq context, so we can enable > per cpu bio cache by default. > > Benchmarked with t/io_uring and ext4+nvme: > taskset -c 6 /root/fio/t/io_uring -p0 -d128 -b4096 -s1 -c1 -F1 -B1 -R1 > -X1 -n1 -P1 /mnt/testfile > base IOPS is 562K, patch IOPS is 574K. The CPU usage of bio_alloc_bioset > decrease from 1.42% to 1.22%. > > The worst case is allocate bio in CPU A but free in CPU B, still use > t/io_uring and ext4+nvme: > base IOPS is 648K, patch IOPS is 647K. Just be curious, how do you run the remote bio free test? If the nvme is 1:1 mapping, you may not trigger it. BTW, ublk has this kind of remote bio free trouble, but not see IOPS drop with this patch. The patch itself looks fine for me. Thanks, Ming From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id UIYdKg5x7GgxGCAAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 03:25:02 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 03:25:02 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v89BG-00000009j1p-0sQK for hi@josie.lol; Mon, 13 Oct 2025 03:25:02 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id CEEB64E1495 for ; Mon, 13 Oct 2025 03:25:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F39CF1DDC1D; Mon, 13 Oct 2025 03:24:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="xKqmaYxe" X-Original-To: io-uring@vger.kernel.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 A325117A2FB; Mon, 13 Oct 2025 03:24:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760325898; cv=none; b=tUrwTYEbBll+kmpTlEYyzNUm0LvAWPX3kg6c3xWi1PybOaJNk9FIVj+YuNY/BX3Sx/6EqXFjsS+NT7ktssgtg5ijJqdeiEDS3bnAQnF28V4f+bOKno33XuuR3m6lN7IlU1AauFsucoHCZTxpb4k92e8tUIWhlFpANiewC9mpEIc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760325898; c=relaxed/simple; bh=50dS+0y+6FY2yD3kd/3EeJU4s/xR6yAIQs/bi9vgnaQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=DuNORoUoyHmo9LrakEEBFDf1M9Oodbebf9r5VerilI27UGBkP/KKHcGtu4O9TjGkMOYsKeDq/nvpw6nqrdCynUnY4jynOndS1NL2mnJ2WPWO7cIhVO8aQmUpKRZFgiTYdy1k23TZoiSEfvGnm8pXcmVrokuNCPdqX2z7jZA/VIQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=xKqmaYxe; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=qOaNuHQTU+ztL3RFVtOr9Vvm14VlAtgrXtrwZtrsN7U=; b=xKqmaYxeNyS/sTBLsfrN0ZwnUg YvvpgeqHtj8tiGblShgqzzNG3f8FN6cU/WyuQnFTQwhlCNdJRkgps/cr4LOrx/1npVCGPijMCK12S smQRgQMazwXgbKypHchcgGLEHl0xVBbX8lE0nc/H0PZvNYdhV5JgWvlKPH1zbJYm0VeHa49YMJFVl XWpXMgkQOyNoAuRw7NFtxN43UmcRfIBfiqS5KhkJ9r6sQoCoN8rQb4KZjoqzYnqAHyBvgxkHRPAtV dfGwbD0iqkSV2txadKK7n1vxY8wU83xk/0BRwSNcBJ2LTC8R8ER+NLwKZejFSo9BZttjaVT2FCw+B +vB7wJ+g==; Received: from hch by bombadil.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1v89B7-0000000C9wP-37SV; Mon, 13 Oct 2025 03:24:53 +0000 Date: Sun, 12 Oct 2025 20:24:53 -0700 From: Christoph Hellwig To: Fengnan Chang Cc: axboe@kernel.dk, viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, asml.silence@gmail.com, willy@infradead.org, djwong@kernel.org, hch@infradead.org, ritesh.list@gmail.com, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org Subject: Re: [PATCH] block: enable per-cpu bio cache by default Message-ID: References: <20251011013312.20698-1-changfengnan@bytedance.com> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251011013312.20698-1-changfengnan@bytedance.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-DKIM: signer='infradead.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: infradead.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On Sat, Oct 11, 2025 at 09:33:12AM +0800, Fengnan Chang wrote: > + opf |= REQ_ALLOC_CACHE; > + if (bs->cache && nr_vecs <= BIO_INLINE_VECS) { > + bio = bio_alloc_percpu_cache(bdev, nr_vecs, opf, > + gfp_mask, bs); > + if (bio) > + return bio; > + /* > + * No cached bio available, bio returned below marked with > + * REQ_ALLOC_CACHE to participate in per-cpu alloc cache. > + */ > + } else > + opf &= ~REQ_ALLOC_CACHE; Just set the req flag in the branch instead of unconditionally setting it and then clearing it. > + /* > + * Even REQ_ALLOC_CACHE is enabled by default, we still need this to > + * mark bio is allocated by bio_alloc_bioset. > + */ > if (rq->cmd_flags & REQ_ALLOC_CACHE && (nr_vecs <= BIO_INLINE_VECS)) { I can't really parse the comment, can you explain what you mean? From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id 8J0KJmq26WgwTxoAYBR5ng (envelope-from ) for ; Sat, 11 Oct 2025 01:44:10 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Sat, 11 Oct 2025 01:44:10 +0000 Received: from ams.mirrors.kernel.org ([213.196.21.55]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v7OeY-00000007Nec-0SOD for hi@josie.lol; Sat, 11 Oct 2025 01:44:10 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.mirrors.kernel.org (Postfix) with ESMTPS id C83CF34FE72 for ; Sat, 11 Oct 2025 01:44:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E321313777E; Sat, 11 Oct 2025 01:44:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="J7Vq8n/8" X-Original-To: io-uring@vger.kernel.org Received: from mail-vs1-f50.google.com (mail-vs1-f50.google.com [209.85.217.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F0C4178F20 for ; Sat, 11 Oct 2025 01:44:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760147044; cv=none; b=IP21PXHeYbwYkdZxDlgS2oH5JRALhNnbnxRfE6Z0U85NORdgLtATXPAWRaavKIxGTCuWSDzQvp06WI28U+G+/vuMUxju+lN+4ctBaax8kMyiAGnGJl/Gb94tnvX5wKbnZUXbbirDxM3VZ2iqDwCdAl6id+k+v5nzcz8Ke0plriQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760147044; c=relaxed/simple; bh=T+IdLzRTTxOQ0Z7SCLa56SnM6nhwUwKs07m9AmkVVyE=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=E0VEzaSOlh9GjgdIUy3sMqIXcgI3MOW4M0KO/bRNj2P9+qFAdXbE1XKv2YDnj+3rOfFZTvfJjTuHwBmXVJdVpBdBSusGRGvnA/pRXzlPqfTSdN9j4umwJc/disegSdDweRaBxuaJK/8JF/3Z2UR53lGxdKG0H16pDZMimBEuk5Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=J7Vq8n/8; arc=none smtp.client-ip=209.85.217.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-vs1-f50.google.com with SMTP id ada2fe7eead31-59dff155dc6so1394871137.3 for ; Fri, 10 Oct 2025 18:44:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760147042; x=1760751842; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=lZhc66zsxEtV1w8Yg5Xh9+RLE7pB3ih7eNk7XgCUWWk=; b=J7Vq8n/8XeoyYAq6UM7v4iusmsqiPV3dCbTwxuZw7EXzoIcuILlPXwCC+KlCQZ5uLA RrPq/PfJzICjcTOM7U15uj/kqrVbmGvV+ZZ0S8BAAaSCEblz4QFq+Mo8r1cf8HUwamwf Pdom9uwpmo5vTEYs/90loRY1KGL1f+WJFWHv8pk5GSAgW5CLPKc7LiI2XcIFC4W5dDER opbcR008ve17+P/H7s2h16+MZd3iKSf+QlEnK7eP+JVRMUNBV4wEKBjbv85SocJa1UVa t1whWnojqaNG0oUQ9cb2TlRJ0gBoVGnt8u+/JpD31c1K6jfgRxTz9vpBTEqFvAfOEyvc IQWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760147042; x=1760751842; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lZhc66zsxEtV1w8Yg5Xh9+RLE7pB3ih7eNk7XgCUWWk=; b=FAI8kOCIUUaT6uSwal/ghC4T6dzOG0+Rbnnoev6C88ZESYnQNwCJIZ5mwVuVXozOUg hA9TBd8RjRzdk3wuk8ErzGNAGcO3HEyzqZJ6B1kRKlWEe56YdHU9ynvPMd4PYsPTg8NL BV68OD4ko3rA5udqzNmUI6w/jI7ZrXTVB6PuT7I/ZoEcqmbGQrWqrBqGvxyYKOb0gruP OO9BpA2TCKIAAfm2WUjyG/s1yZLy/lpvVowQ6DkM3IrWG9kZxx3XdFx+lmEw6VzWHi7m 3sZ7Ga1ySnexWPg4GPBntQKqS37KxLqnrwh8UpBrfuPf3kTjOzJjhqgns1v8ABDvlDGe rwtg== X-Forwarded-Encrypted: i=1; AJvYcCV8JJ/Z60Q15mXuX2mtuCXrMqULjOsuT3KHqqzehVI/kz9nh2vo7RSVFrLxsxcyJ2304qi1RR9Ehw==@vger.kernel.org X-Gm-Message-State: AOJu0YzHJWRKGxfBqSvamOz4xd0ZZuG1+fo0R0AI9i/siCX/4KeHihT8 MijXCJsUwwvjxLxduErSliSArYhi9OuxeKd2Lx5QF1zoi4lH40sJx+SuS+uxkJnsvM54AKoUfeA rM5XYYF731fA3GN9cjiTEXeqUiyed5r0= X-Gm-Gg: ASbGncug07/w+C2ba1EyeVSFuv+bo1DSMEm1XHZc6sujyElcBK3Ov3Rh1hFg4SE8Nvq G/xxxZIMPftwa6JpzJNXiFJqJDHrUVRp/HBmW/pDDG+tHL8qigy/0uWJ5/2BoFp+KdFwCLLzqrZ RJz/5d0umOL9WJw9g43kzJXGAK221tPhQFDYWz5LRQ4HH0EORg0yZmYtqa9YzkBuH3KGaWWDFli oYJQrZDDfaPCmKCkXqESgN+3IgjRO2/ X-Google-Smtp-Source: AGHT+IE7mG3LNkxY+CyodDwm/x4ptJOMQVJ+H4EmrH8p/RVIObpZc3vVfG1SaOV6rlrj3vGwgT1jiZxnhaAD3dJIuBQ= X-Received: by 2002:a05:6102:6cf:b0:524:b344:748d with SMTP id ada2fe7eead31-5d5e23474fcmr5780092137.17.1760147041875; Fri, 10 Oct 2025 18:44:01 -0700 (PDT) Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20251011013312.20698-1-changfengnan@bytedance.com> In-Reply-To: From: fengnan chang Date: Sat, 11 Oct 2025 09:43:51 +0800 X-Gm-Features: AS18NWCBO3jy7FdLyGcQVogGXlatyQB1qaqtXtY1KzxOp2alt1gh71U3rIH7rWo Message-ID: Subject: Re: [PATCH] block: enable per-cpu bio cache by default To: Fengnan Chang , linux-block@vger.kernel.org Cc: axboe@kernel.dk, viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, asml.silence@gmail.com, willy@infradead.org, djwong@kernel.org, hch@infradead.org, ritesh.list@gmail.com, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [213.196.21.55 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [fengnanchang[at]gmail.com] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 cc more maillist On Sat, Oct 11, 2025 at 9:36=E2=80=AFAM fengnan chang wrote: > > The attachment is result of fio test ext4/xfs with > libaio/sync/io_uring on null_blk and > nvme. > > On Sat, Oct 11, 2025 at 9:33=E2=80=AFAM Fengnan Chang > wrote: > > > > Per cpu bio cache was only used in the io_uring + raw block device, > > after commit 12e4e8c7ab59 ("io_uring/rw: enable bio caches for IRQ > > rw"), bio_put is safe for task and irq context, bio_alloc_bioset is > > safe for task context and no one calls in irq context, so we can enable > > per cpu bio cache by default. > > > > Benchmarked with t/io_uring and ext4+nvme: > > taskset -c 6 /root/fio/t/io_uring -p0 -d128 -b4096 -s1 -c1 -F1 -B1 -R1 > > -X1 -n1 -P1 /mnt/testfile > > base IOPS is 562K, patch IOPS is 574K. The CPU usage of bio_alloc_biose= t > > decrease from 1.42% to 1.22%. > > > > The worst case is allocate bio in CPU A but free in CPU B, still use > > t/io_uring and ext4+nvme: > > base IOPS is 648K, patch IOPS is 647K. > > > > Also use fio test ext4/xfs with libaio/sync/io_uring on null_blk and > > nvme, no obvious performance regression. > > > > Signed-off-by: Fengnan Chang > > --- > > block/bio.c | 26 ++++++++++++-------------- > > block/blk-map.c | 4 ++++ > > block/fops.c | 4 ---- > > include/linux/fs.h | 3 --- > > io_uring/rw.c | 1 - > > 5 files changed, 16 insertions(+), 22 deletions(-) > > > > diff --git a/block/bio.c b/block/bio.c > > index 3b371a5da159..16b20c10cab7 100644 > > --- a/block/bio.c > > +++ b/block/bio.c > > @@ -513,20 +513,18 @@ struct bio *bio_alloc_bioset(struct block_device = *bdev, unsigned short nr_vecs, > > if (WARN_ON_ONCE(!mempool_initialized(&bs->bvec_pool) && nr_vec= s > 0)) > > return NULL; > > > > - if (opf & REQ_ALLOC_CACHE) { > > - if (bs->cache && nr_vecs <=3D BIO_INLINE_VECS) { > > - bio =3D bio_alloc_percpu_cache(bdev, nr_vecs, o= pf, > > - gfp_mask, bs); > > - if (bio) > > - return bio; > > - /* > > - * No cached bio available, bio returned below = marked with > > - * REQ_ALLOC_CACHE to particpate in per-cpu all= oc cache. > > - */ > > - } else { > > - opf &=3D ~REQ_ALLOC_CACHE; > > - } > > - } > > + opf |=3D REQ_ALLOC_CACHE; > > + if (bs->cache && nr_vecs <=3D BIO_INLINE_VECS) { > > + bio =3D bio_alloc_percpu_cache(bdev, nr_vecs, opf, > > + gfp_mask, bs); > > + if (bio) > > + return bio; > > + /* > > + * No cached bio available, bio returned below marked w= ith > > + * REQ_ALLOC_CACHE to participate in per-cpu alloc cach= e. > > + */ > > + } else > > + opf &=3D ~REQ_ALLOC_CACHE; > > > > /* > > * submit_bio_noacct() converts recursion to iteration; this me= ans if > > diff --git a/block/blk-map.c b/block/blk-map.c > > index 23e5d5ebe59e..570a7ca6edd1 100644 > > --- a/block/blk-map.c > > +++ b/block/blk-map.c > > @@ -255,6 +255,10 @@ static struct bio *blk_rq_map_bio_alloc(struct req= uest *rq, > > { > > struct bio *bio; > > > > + /* > > + * Even REQ_ALLOC_CACHE is enabled by default, we still need th= is to > > + * mark bio is allocated by bio_alloc_bioset. > > + */ > > if (rq->cmd_flags & REQ_ALLOC_CACHE && (nr_vecs <=3D BIO_INLINE= _VECS)) { > > bio =3D bio_alloc_bioset(NULL, nr_vecs, rq->cmd_flags, = gfp_mask, > > &fs_bio_set); > > diff --git a/block/fops.c b/block/fops.c > > index ddbc69c0922b..090562a91b4c 100644 > > --- a/block/fops.c > > +++ b/block/fops.c > > @@ -177,8 +177,6 @@ static ssize_t __blkdev_direct_IO(struct kiocb *ioc= b, struct iov_iter *iter, > > loff_t pos =3D iocb->ki_pos; > > int ret =3D 0; > > > > - if (iocb->ki_flags & IOCB_ALLOC_CACHE) > > - opf |=3D REQ_ALLOC_CACHE; > > bio =3D bio_alloc_bioset(bdev, nr_pages, opf, GFP_KERNEL, > > &blkdev_dio_pool); > > dio =3D container_of(bio, struct blkdev_dio, bio); > > @@ -326,8 +324,6 @@ static ssize_t __blkdev_direct_IO_async(struct kioc= b *iocb, > > loff_t pos =3D iocb->ki_pos; > > int ret =3D 0; > > > > - if (iocb->ki_flags & IOCB_ALLOC_CACHE) > > - opf |=3D REQ_ALLOC_CACHE; > > bio =3D bio_alloc_bioset(bdev, nr_pages, opf, GFP_KERNEL, > > &blkdev_dio_pool); > > dio =3D container_of(bio, struct blkdev_dio, bio); > > diff --git a/include/linux/fs.h b/include/linux/fs.h > > index 601d036a6c78..18ec41732186 100644 > > --- a/include/linux/fs.h > > +++ b/include/linux/fs.h > > @@ -365,8 +365,6 @@ struct readahead_control; > > /* iocb->ki_waitq is valid */ > > #define IOCB_WAITQ (1 << 19) > > #define IOCB_NOIO (1 << 20) > > -/* can use bio alloc cache */ > > -#define IOCB_ALLOC_CACHE (1 << 21) > > /* > > * IOCB_DIO_CALLER_COMP can be set by the iocb owner, to indicate that= the > > * iocb completion can be passed back to the owner for execution from = a safe > > @@ -399,7 +397,6 @@ struct readahead_control; > > { IOCB_WRITE, "WRITE" }, \ > > { IOCB_WAITQ, "WAITQ" }, \ > > { IOCB_NOIO, "NOIO" }, \ > > - { IOCB_ALLOC_CACHE, "ALLOC_CACHE" }, \ > > { IOCB_DIO_CALLER_COMP, "CALLER_COMP" }, \ > > { IOCB_AIO_RW, "AIO_RW" }, \ > > { IOCB_HAS_METADATA, "AIO_HAS_METADATA" } > > diff --git a/io_uring/rw.c b/io_uring/rw.c > > index af5a54b5db12..fa7655ab9097 100644 > > --- a/io_uring/rw.c > > +++ b/io_uring/rw.c > > @@ -856,7 +856,6 @@ static int io_rw_init_file(struct io_kiocb *req, fm= ode_t mode, int rw_type) > > ret =3D kiocb_set_rw_flags(kiocb, rw->flags, rw_type); > > if (unlikely(ret)) > > return ret; > > - kiocb->ki_flags |=3D IOCB_ALLOC_CACHE; > > > > /* > > * If the file is marked O_NONBLOCK, still allow retry for it i= f it > > -- > > 2.39.5 (Apple Git-154) > > > > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id QKiXJb+06WhWJRcAYBR5ng (envelope-from ) for ; Sat, 11 Oct 2025 01:37:03 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Sat, 11 Oct 2025 01:37:03 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v7OXe-00000007BEj-15cG for hi@josie.lol; Sat, 11 Oct 2025 01:37:03 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 430C9189B46E for ; Sat, 11 Oct 2025 01:37:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B033C12CDBE; Sat, 11 Oct 2025 01:36:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lQUL/Zb2" X-Original-To: io-uring@vger.kernel.org Received: from mail-vs1-f43.google.com (mail-vs1-f43.google.com [209.85.217.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CBB8978F58 for ; Sat, 11 Oct 2025 01:36:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760146615; cv=none; b=sNws9w92kefxARmOeg40YWSta/4+mz5k4Kb3NRQxgMjB7J1REGGC5JCjfLZkvc4NnGlqz8L4P/EPX09uxatQjsk7CLLrWcefUAa/EckaMwdLVzlh1JuoaAwyo+S5xrbAz1H28x5KynTjmWL8HlP+wdoobo1/foatl16pwiZQiNw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760146615; c=relaxed/simple; bh=EI92tD2ekNY9znd2aIDrmEl5JP7z1h6PqmZ/qFJ3vqE=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=HoI2xhdUsiflU1fqSpOZbOTxfi46WhJ41MBB4Ukq2YFrjoPke6lHi+enXdBpCbEjRa9zinah4MHukidBF2U67YnxHZA8x1xFgvGZoJt2VRgKc9B2vuEUD0aa/e7AEEV6BY+JrbVnI0FDTbw1JBo3JmyX7UCOYEDJftP/Yg2DN8M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lQUL/Zb2; arc=none smtp.client-ip=209.85.217.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-vs1-f43.google.com with SMTP id ada2fe7eead31-5b59694136bso1733834137.0 for ; Fri, 10 Oct 2025 18:36:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760146612; x=1760751412; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=mBJizGUgEpYGswfZnE/4ygy5EJJgODT4Yw4xTF/MqiA=; b=lQUL/Zb27GOiwIn4q2vH2ww8OduAL9BbbJZhVw0fG1qH6ZwpcjkiI6fVGPd9YfepuI yY2hntxmY2Fuu8vOlnA41i9HwVqNR1Le6bXYK4gISbDlAzo6Hr/+HLsXNUCaK11FMVk4 h9ZXShd1FnZxxq5PTTZNsOYiWGOrYBismrDwL6sObLYbHpcchKYHlsWovfYXlGme+puC UfIOONM6XaYAljUVsHy5ZBDmye7E9WZZuUb5+WmqwEqcTg3sT+rwO+tnZdgIf6qV4rh+ fBJnyA1h6A6LwFj2EOE6je3q0LWgvdF3vifxgTBzCIEIzGRJ/rzk1Myhhg4zJi1wvyuw MGGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760146612; x=1760751412; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mBJizGUgEpYGswfZnE/4ygy5EJJgODT4Yw4xTF/MqiA=; b=CaH0zoO4DW1QvvP4XJAjdbZQvic8PrDb4B1S+89E4/ITOpae6zv8DnL9rIrG2UpWPb zvXYSYt6VtodbGDgGbb/WXG18qaavCsI9JymJ9yacoCE+Pp2RWrwDTywIsj0zxLP4RQe g+p+wJ1dZgx4CQXVpHXI429lccJZgfeRbcawsmxrG78S8r6Kl4OY7CldMAhbaYzjY+l4 PaftNIRwKMGt6mMWNFGMHA6cWTAembjQ3vkcTnD2Iq3NtKGtckJzOB073llOn/3yjJz9 VMN7OMqHIZ3ET2NdPGzeaSOBNZbZab4povOPZyxQDds0lIssvpPnqZaxRT7hyghNjAAp YyEA== X-Forwarded-Encrypted: i=1; AJvYcCUXw/eFeOgbOEQNmAEDTQeSSbUIpmPQZk4ay9yjKPxRYGTeRONIsZS7qM4DULnrG8pGEmIJu5zbKQ==@vger.kernel.org X-Gm-Message-State: AOJu0YyI/+3Td9urcvPq6ou/Fu/jnikvueepIkXqepuRcrdIVEhXl8/i /PyAvEHPfvoWHQrclMVIBfliPLL19T8PaJFvwCWJNe1xGoJ0JPk0G4SZrzUZr9UvnsZ27YeFnyb q/PfIJcLUll6ttmsfpTl5TL4zMX1X8Io= X-Gm-Gg: ASbGncvHtC0DClMzYcY8BiZ00DLGY22B2hl54q4BP085DGzzQXYfiS2Halx9DsGt1jk bD+F8pU4nbdzb4KoM3vZ5J3P7lNksv1Xt0zzFztHG3nN8jfVSb9ChKy0PsDH4LKwAV1q51MwORu Om7yggetbDUaZy+KVxRm4tSF9RnQWj1x0lJhFrX73IwQWsbDAM2sha5fuAHiTS3S+hiurWKQIX9 V0rECHn1JdB6EkjObcgzAnFFy1fpTag X-Google-Smtp-Source: AGHT+IESqXD+sAJU0UEVWj76dLuyL8FrMeXCBU1+UXnz8MOvyl5UiuOPTfT2xAnd0FOfhNriZ/01x84p+9k074pueck= X-Received: by 2002:a05:6102:370a:b0:555:56e0:f372 with SMTP id ada2fe7eead31-5d5e2214819mr6787372137.2.1760146611474; Fri, 10 Oct 2025 18:36:51 -0700 (PDT) Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20251011013312.20698-1-changfengnan@bytedance.com> In-Reply-To: <20251011013312.20698-1-changfengnan@bytedance.com> From: fengnan chang Date: Sat, 11 Oct 2025 09:36:40 +0800 X-Gm-Features: AS18NWDU8s7kow6ad7JFvS6dQVHCD9f5xPFn94TSfdfbrwO4Kq4EFRWmtZGnRTw Message-ID: Subject: Re: [PATCH] block: enable per-cpu bio cache by default To: Fengnan Chang Cc: axboe@kernel.dk, viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, asml.silence@gmail.com, willy@infradead.org, djwong@kernel.org, hch@infradead.org, ritesh.list@gmail.com, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: multipart/mixed; boundary="00000000000087c6740640d8117c" X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.80.249 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [fengnanchang[at]gmail.com] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 --00000000000087c6740640d8117c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable The attachment is result of fio test ext4/xfs with libaio/sync/io_uring on null_blk and nvme. On Sat, Oct 11, 2025 at 9:33=E2=80=AFAM Fengnan Chang wrote: > > Per cpu bio cache was only used in the io_uring + raw block device, > after commit 12e4e8c7ab59 ("io_uring/rw: enable bio caches for IRQ > rw"), bio_put is safe for task and irq context, bio_alloc_bioset is > safe for task context and no one calls in irq context, so we can enable > per cpu bio cache by default. > > Benchmarked with t/io_uring and ext4+nvme: > taskset -c 6 /root/fio/t/io_uring -p0 -d128 -b4096 -s1 -c1 -F1 -B1 -R1 > -X1 -n1 -P1 /mnt/testfile > base IOPS is 562K, patch IOPS is 574K. The CPU usage of bio_alloc_bioset > decrease from 1.42% to 1.22%. > > The worst case is allocate bio in CPU A but free in CPU B, still use > t/io_uring and ext4+nvme: > base IOPS is 648K, patch IOPS is 647K. > > Also use fio test ext4/xfs with libaio/sync/io_uring on null_blk and > nvme, no obvious performance regression. > > Signed-off-by: Fengnan Chang > --- > block/bio.c | 26 ++++++++++++-------------- > block/blk-map.c | 4 ++++ > block/fops.c | 4 ---- > include/linux/fs.h | 3 --- > io_uring/rw.c | 1 - > 5 files changed, 16 insertions(+), 22 deletions(-) > > diff --git a/block/bio.c b/block/bio.c > index 3b371a5da159..16b20c10cab7 100644 > --- a/block/bio.c > +++ b/block/bio.c > @@ -513,20 +513,18 @@ struct bio *bio_alloc_bioset(struct block_device *b= dev, unsigned short nr_vecs, > if (WARN_ON_ONCE(!mempool_initialized(&bs->bvec_pool) && nr_vecs = > 0)) > return NULL; > > - if (opf & REQ_ALLOC_CACHE) { > - if (bs->cache && nr_vecs <=3D BIO_INLINE_VECS) { > - bio =3D bio_alloc_percpu_cache(bdev, nr_vecs, opf= , > - gfp_mask, bs); > - if (bio) > - return bio; > - /* > - * No cached bio available, bio returned below ma= rked with > - * REQ_ALLOC_CACHE to particpate in per-cpu alloc= cache. > - */ > - } else { > - opf &=3D ~REQ_ALLOC_CACHE; > - } > - } > + opf |=3D REQ_ALLOC_CACHE; > + if (bs->cache && nr_vecs <=3D BIO_INLINE_VECS) { > + bio =3D bio_alloc_percpu_cache(bdev, nr_vecs, opf, > + gfp_mask, bs); > + if (bio) > + return bio; > + /* > + * No cached bio available, bio returned below marked wit= h > + * REQ_ALLOC_CACHE to participate in per-cpu alloc cache. > + */ > + } else > + opf &=3D ~REQ_ALLOC_CACHE; > > /* > * submit_bio_noacct() converts recursion to iteration; this mean= s if > diff --git a/block/blk-map.c b/block/blk-map.c > index 23e5d5ebe59e..570a7ca6edd1 100644 > --- a/block/blk-map.c > +++ b/block/blk-map.c > @@ -255,6 +255,10 @@ static struct bio *blk_rq_map_bio_alloc(struct reque= st *rq, > { > struct bio *bio; > > + /* > + * Even REQ_ALLOC_CACHE is enabled by default, we still need this= to > + * mark bio is allocated by bio_alloc_bioset. > + */ > if (rq->cmd_flags & REQ_ALLOC_CACHE && (nr_vecs <=3D BIO_INLINE_V= ECS)) { > bio =3D bio_alloc_bioset(NULL, nr_vecs, rq->cmd_flags, gf= p_mask, > &fs_bio_set); > diff --git a/block/fops.c b/block/fops.c > index ddbc69c0922b..090562a91b4c 100644 > --- a/block/fops.c > +++ b/block/fops.c > @@ -177,8 +177,6 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb,= struct iov_iter *iter, > loff_t pos =3D iocb->ki_pos; > int ret =3D 0; > > - if (iocb->ki_flags & IOCB_ALLOC_CACHE) > - opf |=3D REQ_ALLOC_CACHE; > bio =3D bio_alloc_bioset(bdev, nr_pages, opf, GFP_KERNEL, > &blkdev_dio_pool); > dio =3D container_of(bio, struct blkdev_dio, bio); > @@ -326,8 +324,6 @@ static ssize_t __blkdev_direct_IO_async(struct kiocb = *iocb, > loff_t pos =3D iocb->ki_pos; > int ret =3D 0; > > - if (iocb->ki_flags & IOCB_ALLOC_CACHE) > - opf |=3D REQ_ALLOC_CACHE; > bio =3D bio_alloc_bioset(bdev, nr_pages, opf, GFP_KERNEL, > &blkdev_dio_pool); > dio =3D container_of(bio, struct blkdev_dio, bio); > diff --git a/include/linux/fs.h b/include/linux/fs.h > index 601d036a6c78..18ec41732186 100644 > --- a/include/linux/fs.h > +++ b/include/linux/fs.h > @@ -365,8 +365,6 @@ struct readahead_control; > /* iocb->ki_waitq is valid */ > #define IOCB_WAITQ (1 << 19) > #define IOCB_NOIO (1 << 20) > -/* can use bio alloc cache */ > -#define IOCB_ALLOC_CACHE (1 << 21) > /* > * IOCB_DIO_CALLER_COMP can be set by the iocb owner, to indicate that t= he > * iocb completion can be passed back to the owner for execution from a = safe > @@ -399,7 +397,6 @@ struct readahead_control; > { IOCB_WRITE, "WRITE" }, \ > { IOCB_WAITQ, "WAITQ" }, \ > { IOCB_NOIO, "NOIO" }, \ > - { IOCB_ALLOC_CACHE, "ALLOC_CACHE" }, \ > { IOCB_DIO_CALLER_COMP, "CALLER_COMP" }, \ > { IOCB_AIO_RW, "AIO_RW" }, \ > { IOCB_HAS_METADATA, "AIO_HAS_METADATA" } > diff --git a/io_uring/rw.c b/io_uring/rw.c > index af5a54b5db12..fa7655ab9097 100644 > --- a/io_uring/rw.c > +++ b/io_uring/rw.c > @@ -856,7 +856,6 @@ static int io_rw_init_file(struct io_kiocb *req, fmod= e_t mode, int rw_type) > ret =3D kiocb_set_rw_flags(kiocb, rw->flags, rw_type); > if (unlikely(ret)) > return ret; > - kiocb->ki_flags |=3D IOCB_ALLOC_CACHE; > > /* > * If the file is marked O_NONBLOCK, still allow retry for it if = it > -- > 2.39.5 (Apple Git-154) > > --00000000000087c6740640d8117c Content-Type: text/csv; charset="US-ASCII"; name="nullblk_fs_results.csv" Content-Disposition: attachment; filename="nullblk_fs_results.csv" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_mgllrr610 ZW5naW5lLG1lZGl1bSxmc190eXBlLG51bWpvYnMscWRlcHRoLHBhdHRlcm4sYnMscmVwZWF0X2lk LElPUFMsSU9QU19uZXcsZGlmZg0KaW9fdXJpbmcsbnVsbF9ibGssZXh0NCwxLDEscmFuZHJlYWQs NGssMSw0NDExOTguODI2Nyw0NDQ0MjcuNDg1OCwwLjczMiUNCmlvX3VyaW5nLG51bGxfYmxrLGV4 dDQsMSwxLHJhbmRyZWFkLDRrLDIsNDM4MjkyLjAyMzYsNDQ0NjI2Ljg3OTEsMS40NDUlDQppb191 cmluZyxudWxsX2JsayxleHQ0LDY0LDEscmFuZHJlYWQsNGssMSw2MjMzOTMuMzQwNCw2MjYyMTQu ODE5LDAuNDUzJQ0KaW9fdXJpbmcsbnVsbF9ibGssZXh0NCw2NCwxLHJhbmRyZWFkLDRrLDIsNjQ3 NzAzLjkwOTksNjUxODE3LjIxMjIsMC42MzUlDQppb191cmluZyxudWxsX2JsayxleHQ0LDEsNjQs cmFuZHJlYWQsNGssMSw0MzczNDguMTU1MSw0NDczNzguMTU0MSwyLjI5MyUNCmlvX3VyaW5nLG51 bGxfYmxrLGV4dDQsMSw2NCxyYW5kcmVhZCw0aywyLDQzODQyMC42ODYsNDM5MDkwLjU5NywwLjE1 MyUNCmlvX3VyaW5nLG51bGxfYmxrLGV4dDQsNjQsNjQscmFuZHJlYWQsNGssMSw2MTMwMjIuMjMx OSw2Mjc0ODQuMzY3NywyLjM1OSUNCmlvX3VyaW5nLG51bGxfYmxrLGV4dDQsNjQsNjQscmFuZHJl YWQsNGssMiw2MzU0OTkuMjY2Nyw2NDQ5NTUuOTY4MSwxLjQ4OCUNCnN5bmMsbnVsbF9ibGssZXh0 NCwxLDEscmFuZHJlYWQsNGssMSw0NTQwODQuMTYzOSw0Njg4MzQuOTM4OCwzLjI0OCUNCnN5bmMs bnVsbF9ibGssZXh0NCwxLDEscmFuZHJlYWQsNGssMiw0NTU4MjQuMTcyNSw0Njg1NDcuOTE1MSwy Ljc5MSUNCnN5bmMsbnVsbF9ibGssZXh0NCw2NCwxLHJhbmRyZWFkLDRrLDEsNjcwNDI0Ljg1MjUs NjQyODk0Ljg3MDIsLTQuMTA2JQ0Kc3luYyxudWxsX2JsayxleHQ0LDY0LDEscmFuZHJlYWQsNGss Miw2NjgwMTEuMTMyNiw2NjI5NTYuNDY5NiwtMC43NTclDQpzeW5jLG51bGxfYmxrLGV4dDQsMSw2 NCxyYW5kcmVhZCw0aywxLDQ1NTQyMC4zNTI3LDQ2ODk3OS4xNjc0LDIuOTc3JQ0Kc3luYyxudWxs X2JsayxleHQ0LDEsNjQscmFuZHJlYWQsNGssMiw0NTQ5OTQuOTAwMiw0Njg5OTguMzY2NywzLjA3 OCUNCnN5bmMsbnVsbF9ibGssZXh0NCw2NCw2NCxyYW5kcmVhZCw0aywxLDYzNDcyOC41NTE0LDY1 MzIwNy4xOTMxLDIuOTExJQ0Kc3luYyxudWxsX2JsayxleHQ0LDY0LDY0LHJhbmRyZWFkLDRrLDIs NjUzMzkwLjY4Nyw2NjQ5NDQuNjY4NSwxLjc2OCUNCmxpYmFpbyxudWxsX2JsayxleHQ0LDEsMSxy YW5kcmVhZCw0aywxLDM5Mjg3OC45NzA3LDM5NjcyNi40NDI1LDAuOTc5JQ0KbGliYWlvLG51bGxf YmxrLGV4dDQsMSwxLHJhbmRyZWFkLDRrLDIsMzk0NDYxLjU4NDYsMzg2MjkwLjA1NywtMi4wNzIl DQpsaWJhaW8sbnVsbF9ibGssZXh0NCw2NCwxLHJhbmRyZWFkLDRrLDEsNjYyNzAyLjk1MzEsNjI2 NzM3LjQ4NDIsLTUuNDI3JQ0KbGliYWlvLG51bGxfYmxrLGV4dDQsNjQsMSxyYW5kcmVhZCw0aywy LDY2NDM3My4yNDE4LDY0OTU3Ny4yNjE1LC0yLjIyNyUNCmxpYmFpbyxudWxsX2JsayxleHQ0LDEs NjQscmFuZHJlYWQsNGssMSwzODkxNDQuMDYxOSwzOTQ0ODguOTE3LDEuMzczJQ0KbGliYWlvLG51 bGxfYmxrLGV4dDQsMSw2NCxyYW5kcmVhZCw0aywyLDM4ODUxMi43NDk2LDM5NTQ1NC42MTgyLDEu Nzg3JQ0KbGliYWlvLG51bGxfYmxrLGV4dDQsNjQsNjQscmFuZHJlYWQsNGssMSw2NDY3MjUuNzI3 NCw2NjU5OTIuNjMzOCwyLjk3OSUNCmxpYmFpbyxudWxsX2JsayxleHQ0LDY0LDY0LHJhbmRyZWFk LDRrLDIsNjU5MDUxLjQ2MzIsNjY0MzgxLjQ3NDYsMC44MDklDQppb191cmluZyxudWxsX2Jsayxl eHQ0LDEsMSxyYW5kd3JpdGUsNGssMSwzOTQ0MjcuMjE5MSw0MDE5NzcuMjM0MSwxLjkxNCUNCmlv X3VyaW5nLG51bGxfYmxrLGV4dDQsMSwxLHJhbmR3cml0ZSw0aywyLDM5NTUxMS41MTYzLDQwNTA5 Mi4zMzAzLDIuNDIyJQ0KaW9fdXJpbmcsbnVsbF9ibGssZXh0NCw2NCwxLHJhbmR3cml0ZSw0aywx LDU4NjQxNS40MzksNTk1MTAzLjc5MzEsMS40ODIlDQppb191cmluZyxudWxsX2JsayxleHQ0LDY0 LDEscmFuZHdyaXRlLDRrLDIsNTk5MDg5LjI5Nyw2MDEwNjQuODk1NywwLjMzMCUNCmlvX3VyaW5n LG51bGxfYmxrLGV4dDQsMSw2NCxyYW5kd3JpdGUsNGssMSwzODk2ODkuNjQzNyw0MDE3MTYuMzA5 NSwzLjA4NiUNCmlvX3VyaW5nLG51bGxfYmxrLGV4dDQsMSw2NCxyYW5kd3JpdGUsNGssMiwzODky OTQuMzIzNSw0MDAwNjIuNDMxMywyLjc2NiUNCmlvX3VyaW5nLG51bGxfYmxrLGV4dDQsNjQsNjQs cmFuZHdyaXRlLDRrLDEsNTU4MTQ5Ljk1NjcsNTczMDczLjY2NDIsMi42NzQlDQppb191cmluZyxu dWxsX2JsayxleHQ0LDY0LDY0LHJhbmR3cml0ZSw0aywyLDU3ODY3Ny40Nzc0LDU5MjQyMy41Mzg0 LDIuMzc1JQ0Kc3luYyxudWxsX2JsayxleHQ0LDEsMSxyYW5kd3JpdGUsNGssMSw0MDQxNjkuMTI3 Nyw0MTk0MjQuODE5MiwzLjc3NSUNCnN5bmMsbnVsbF9ibGssZXh0NCwxLDEscmFuZHdyaXRlLDRr LDIsNDA3MTIzLjYyOTIsNDE5MTA2LjUyOTgsMi45NDMlDQpzeW5jLG51bGxfYmxrLGV4dDQsNjQs MSxyYW5kd3JpdGUsNGssMSw1ODg3MjguNjA5LDYwNjQ3NS43NjgzLDMuMDE0JQ0Kc3luYyxudWxs X2JsayxleHQ0LDY0LDEscmFuZHdyaXRlLDRrLDIsNTk3Njc3LjQ4ODIsNjA2OTEzLjMzNjIsMS41 NDUlDQpzeW5jLG51bGxfYmxrLGV4dDQsMSw2NCxyYW5kd3JpdGUsNGssMSw0MDQxNzkuNzI3Myw0 MTg3MzMuMjc1NiwzLjYwMSUNCnN5bmMsbnVsbF9ibGssZXh0NCwxLDY0LHJhbmR3cml0ZSw0aywy LDQwNDY5MS41NzY5LDQxODY2Ni44Nzc4LDMuNDUzJQ0Kc3luYyxudWxsX2JsayxleHQ0LDY0LDY0 LHJhbmR3cml0ZSw0aywxLDYwMTczNC41NzU1LDYwMjE0Ny43NTY4LDAuMDY5JQ0Kc3luYyxudWxs X2JsayxleHQ0LDY0LDY0LHJhbmR3cml0ZSw0aywyLDU5OTc0Ny45NTAxLDYwMjU4Ni44NDcxLDAu NDczJQ0KbGliYWlvLG51bGxfYmxrLGV4dDQsMSwxLHJhbmR3cml0ZSw0aywxLDM1NzE5MS40OTM2 LDM2MDc5MS40NzM2LDEuMDA4JQ0KbGliYWlvLG51bGxfYmxrLGV4dDQsMSwxLHJhbmR3cml0ZSw0 aywyLDM1NzQ3OC45NTA3LDM2MDQ1NC41MTgyLDAuODMyJQ0KbGliYWlvLG51bGxfYmxrLGV4dDQs NjQsMSxyYW5kd3JpdGUsNGssMSw2MDE0NDcuNTAzNSw2MDMzNDUuNzQzNiwwLjMxNiUNCmxpYmFp byxudWxsX2JsayxleHQ0LDY0LDEscmFuZHdyaXRlLDRrLDIsNjAyMzA0Ljc4OTgsNjA2MTA2Ljg2 MzEsMC42MzElDQpsaWJhaW8sbnVsbF9ibGssZXh0NCwxLDY0LHJhbmR3cml0ZSw0aywxLDM1MDgy NC40MzkyLDM1NjI0My4xOTE5LDEuNTQ1JQ0KbGliYWlvLG51bGxfYmxrLGV4dDQsMSw2NCxyYW5k d3JpdGUsNGssMiwzNTAxNDUuMDI4NSwzNTQzMjMuNDIyNiwxLjE5MyUNCmxpYmFpbyxudWxsX2Js ayxleHQ0LDY0LDY0LHJhbmR3cml0ZSw0aywxLDU5NTU3MC41OTUzLDU5NjQ2Ni41ODQ0LDAuMTUw JQ0KbGliYWlvLG51bGxfYmxrLGV4dDQsNjQsNjQscmFuZHdyaXRlLDRrLDIsNTk0Mzk3LjkwNjgs NjAyMTY2LjEyMjMsMS4zMDclDQppb191cmluZyxudWxsX2JsayxleHQ0LDEsMSxyZWFkLDRrLDEs NTI5MDM5LjQ5ODcsNTM3MjI1Ljk5MjUsMS41NDclDQppb191cmluZyxudWxsX2JsayxleHQ0LDEs MSxyZWFkLDRrLDIsNTI3NzU5Ljg3NDcsNTM3MjAxLjgyNjYsMS43ODklDQppb191cmluZyxudWxs X2JsayxleHQ0LDY0LDEscmVhZCw0aywxLDE0MDMwNzkuNDYxLDEzODYyODEuNTE1LC0xLjE5NyUN CmlvX3VyaW5nLG51bGxfYmxrLGV4dDQsNjQsMSxyZWFkLDRrLDIsMTQxMDY5OS41NTMsMTM4MDEz OC42MTksLTIuMTY2JQ0KaW9fdXJpbmcsbnVsbF9ibGssZXh0NCwxLDY0LHJlYWQsNGssMSw1Mjk0 NzkuMTUwNyw1MzUyNzYuMzU3NSwxLjA5NSUNCmlvX3VyaW5nLG51bGxfYmxrLGV4dDQsMSw2NCxy ZWFkLDRrLDIsNTI3NzM1LjQ0MjIsNTM4MzE4LjM4OTQsMi4wMDUlDQppb191cmluZyxudWxsX2Js ayxleHQ0LDY0LDY0LHJlYWQsNGssMSwxNDIxNzQ0LjE1LDEzODMwNTAuMzk3LC0yLjcyMiUNCmlv X3VyaW5nLG51bGxfYmxrLGV4dDQsNjQsNjQscmVhZCw0aywyLDE0MzE0NTguMDY5LDEzODU1MDYu MDY2LC0zLjIxMCUNCnN5bmMsbnVsbF9ibGssZXh0NCwxLDEscmVhZCw0aywxLDU4NTg1NC4wMDQ5 LDYwOTg5NS4yNzAyLDQuMTA0JQ0Kc3luYyxudWxsX2JsayxleHQ0LDEsMSxyZWFkLDRrLDIsNTg0 NTQzLjMxNTIsNjA4ODk3LjIzNjgsNC4xNjYlDQpzeW5jLG51bGxfYmxrLGV4dDQsNjQsMSxyZWFk LDRrLDEsMTQyNDIxMC4wOTMsMTQwMTExNS42NTksLTEuNjIyJQ0Kc3luYyxudWxsX2JsayxleHQ0 LDY0LDEscmVhZCw0aywyLDE0MTA0MjIuOTUzLDEzOTgzNTYuOTc2LC0wLjg1NSUNCnN5bmMsbnVs bF9ibGssZXh0NCwxLDY0LHJlYWQsNGssMSw1ODgxOTMuODI2OSw2MDk3OTIuMTA2OSwzLjY3MiUN CnN5bmMsbnVsbF9ibGssZXh0NCwxLDY0LHJlYWQsNGssMiw1ODY2NjkuMTQ0NCw2MTE2OTIuMzEw Myw0LjI2NSUNCnN5bmMsbnVsbF9ibGssZXh0NCw2NCw2NCxyZWFkLDRrLDEsMTQzODEyNS4xNTgs MTQyMjQxOS4zMDUsLTEuMDkyJQ0Kc3luYyxudWxsX2JsayxleHQ0LDY0LDY0LHJlYWQsNGssMiwx NDQzMjM2LjQ1MSwxNDIyMzQ3Ljg0MywtMS40NDclDQpsaWJhaW8sbnVsbF9ibGssZXh0NCwxLDEs cmVhZCw0aywxLDQ2NTc4Mi42MDcyLDQ3NTEyNi44OTU4LDIuMDA2JQ0KbGliYWlvLG51bGxfYmxr LGV4dDQsMSwxLHJlYWQsNGssMiw0Njc0NzkuNDUwNyw0NzQ4NzkuMzA0LDEuNTgzJQ0KbGliYWlv LG51bGxfYmxrLGV4dDQsNjQsMSxyZWFkLDRrLDEsMTQxMTQ5NC44NjcsMTM5MDIwMy41MiwtMS41 MDglDQpsaWJhaW8sbnVsbF9ibGssZXh0NCw2NCwxLHJlYWQsNGssMiwxNDEyNjgxLjg4OCwxMzc5 NzA4LjI1MywtMi4zMzQlDQpsaWJhaW8sbnVsbF9ibGssZXh0NCwxLDY0LHJlYWQsNGssMSw0NjY0 NDMuOTg1Miw0NzIwNDAuMDk4NywxLjIwMCUNCmxpYmFpbyxudWxsX2JsayxleHQ0LDEsNjQscmVh ZCw0aywyLDQ2NTYwMS4yMTMzLDQ3MjAzMC41MzIzLDEuMzgxJQ0KbGliYWlvLG51bGxfYmxrLGV4 dDQsNjQsNjQscmVhZCw0aywxLDEzODcwMjcuMDk4LDEzNzM2ODMuMzIxLC0wLjk2MiUNCmxpYmFp byxudWxsX2JsayxleHQ0LDY0LDY0LHJlYWQsNGssMiwxMzg2NDA0LjgyLDEzNjY4MzQuMzExLC0x LjQxMiUNCmlvX3VyaW5nLG51bGxfYmxrLGV4dDQsMSwxLHdyaXRlLDRrLDEsNDQ0MzQyLjEyMTks NDU3MzAzLjcyMzIsMi45MTclDQppb191cmluZyxudWxsX2JsayxleHQ0LDEsMSx3cml0ZSw0aywy LDQ0NTM4OS41NTM3LDQ1NTAyOC4xOTkxLDIuMTY0JQ0KaW9fdXJpbmcsbnVsbF9ibGssZXh0NCw2 NCwxLHdyaXRlLDRrLDEsOTAzNjk5LjI1MzQsODg2NzUxLjM4MzIsLTEuODc1JQ0KaW9fdXJpbmcs bnVsbF9ibGssZXh0NCw2NCwxLHdyaXRlLDRrLDIsOTQwOTk4LjQ2NjgsOTE2NDQxLjU3MDYsLTIu NjEwJQ0KaW9fdXJpbmcsbnVsbF9ibGssZXh0NCwxLDY0LHdyaXRlLDRrLDEsNDQ0MjY2LjE1Nzgs NDU2MzkyLjUyMDIsMi43MzAlDQppb191cmluZyxudWxsX2JsayxleHQ0LDEsNjQsd3JpdGUsNGss Miw0NDQyNTMuNzI0OSw0NTQ4MTEuMzA2MywyLjM3NiUNCmlvX3VyaW5nLG51bGxfYmxrLGV4dDQs NjQsNjQsd3JpdGUsNGssMSw5MjI2MjguNDU4MSw5MjU3NjcuMDE1NSwwLjM0MCUNCmlvX3VyaW5n LG51bGxfYmxrLGV4dDQsNjQsNjQsd3JpdGUsNGssMiw5NTMyODQuNjgxLDkzMDc5NC4xNDcxLC0y LjM1OSUNCnN5bmMsbnVsbF9ibGssZXh0NCwxLDEsd3JpdGUsNGssMSw0ODgxNzAuODYxLDQ5NzI3 My42MjQyLDEuODY1JQ0Kc3luYyxudWxsX2JsayxleHQ0LDEsMSx3cml0ZSw0aywyLDQ4ODQ4OS44 NTAzLDQ5Njc2NS44NzQ1LDEuNjk0JQ0Kc3luYyxudWxsX2JsayxleHQ0LDY0LDEsd3JpdGUsNGss MSw4NzYzMzIuNjQ0NSw5MDc3NTUuMDQ5NywzLjU4NiUNCnN5bmMsbnVsbF9ibGssZXh0NCw2NCwx LHdyaXRlLDRrLDIsOTAxNzg2LjE4MDksODkyMjEyLjkxOTEsLTEuMDYyJQ0Kc3luYyxudWxsX2Js ayxleHQ0LDEsNjQsd3JpdGUsNGssMSw0ODc5OTcuMzAwMSw0OTY1NjEuOTQ3OSwxLjc1NSUNCnN5 bmMsbnVsbF9ibGssZXh0NCwxLDY0LHdyaXRlLDRrLDIsNDg3MjQ5LjU5MTcsNDk3MjE5LjE5Mjcs Mi4wNDYlDQpzeW5jLG51bGxfYmxrLGV4dDQsNjQsNjQsd3JpdGUsNGssMSw5Mjk0MjUuMzM4Myw5 MTQ2ODkuMTIwNywtMS41ODYlDQpzeW5jLG51bGxfYmxrLGV4dDQsNjQsNjQsd3JpdGUsNGssMiw5 NTg1MjEuNDY1Miw5MTUwOTUuMjYwMywtNC41MzElDQpsaWJhaW8sbnVsbF9ibGssZXh0NCwxLDEs d3JpdGUsNGssMSwzOTU5MTAuNjAzLDQwMDU2MS4zNDgsMS4xNzUlDQpsaWJhaW8sbnVsbF9ibGss ZXh0NCwxLDEsd3JpdGUsNGssMiwzOTYyNTguMjI0Nyw0MDA2NDQuMDc4NSwxLjEwNyUNCmxpYmFp byxudWxsX2JsayxleHQ0LDY0LDEsd3JpdGUsNGssMSw5MjQyNDMuNDQyMyw4ODA0ODcuNTE3MSwt NC43MzQlDQpsaWJhaW8sbnVsbF9ibGssZXh0NCw2NCwxLHdyaXRlLDRrLDIsOTM1MTA5LjY1OTQs OTI1OTk2LjgwMDIsLTAuOTc1JQ0KbGliYWlvLG51bGxfYmxrLGV4dDQsMSw2NCx3cml0ZSw0aywx LDM5NDI5MC4yOTAzLDM5NzM1Ny43NTQ3LDAuNzc4JQ0KbGliYWlvLG51bGxfYmxrLGV4dDQsMSw2 NCx3cml0ZSw0aywyLDM5NTYyMS4wNzkzLDM5NzU3OS45ODA3LDAuNDk1JQ0KbGliYWlvLG51bGxf YmxrLGV4dDQsNjQsNjQsd3JpdGUsNGssMSw5MzY5NzYuMDY4Myw5MTI0OTcuNzAwMiwtMi42MTIl DQpsaWJhaW8sbnVsbF9ibGssZXh0NCw2NCw2NCx3cml0ZSw0aywyLDk1ODU4MS4wMjc5LDg5ODUw Ni43OTk1LC02LjI2NyUNCmlvX3VyaW5nLG51bGxfYmxrLHhmcywxLDEscmFuZHJlYWQsNGssMSwz ODIyMTAuMjkzLDM4NzQ3Ny44MTc0LDEuMzc4JQ0KaW9fdXJpbmcsbnVsbF9ibGsseGZzLDEsMSxy YW5kcmVhZCw0aywyLDM4MzUxOC43NDk0LDM4NjI5OC43OSwwLjcyNSUNCmlvX3VyaW5nLG51bGxf YmxrLHhmcyw2NCwxLHJhbmRyZWFkLDRrLDEsNjM5OTg4LjQzNDEsNjU4Mjg0LjY1NzIsMi44NTkl DQppb191cmluZyxudWxsX2Jsayx4ZnMsNjQsMSxyYW5kcmVhZCw0aywyLDY0NzcyMi4wODUyLDY2 Mzc3OS41ODE0LDIuNDc5JQ0KaW9fdXJpbmcsbnVsbF9ibGsseGZzLDEsNjQscmFuZHJlYWQsNGss MSwzOTA3MTYuNDc2MSwzOTYzNjMuOTg3OSwxLjQ0NSUNCmlvX3VyaW5nLG51bGxfYmxrLHhmcywx LDY0LHJhbmRyZWFkLDRrLDIsMzkwMjUxLjYyNDksMzk0MTk5LjU2LDEuMDEyJQ0KaW9fdXJpbmcs bnVsbF9ibGsseGZzLDY0LDY0LHJhbmRyZWFkLDRrLDEsNjQyNjg0LjU1NDQsNjU3MDE1LjI5ODUs Mi4yMzAlDQppb191cmluZyxudWxsX2Jsayx4ZnMsNjQsNjQscmFuZHJlYWQsNGssMiw2NDI3Njku NTQ4Nyw2NTM4NTAuMzEsMS43MjQlDQpzeW5jLG51bGxfYmxrLHhmcywxLDEscmFuZHJlYWQsNGss MSw0MDA1OTkuOTgsNDEwODc0Ljg3MDgsMi41NjUlDQpzeW5jLG51bGxfYmxrLHhmcywxLDEscmFu ZHJlYWQsNGssMiw0MDAzMjIuNjg5Miw0MDkwNjIuMTk3OSwyLjE4MyUNCnN5bmMsbnVsbF9ibGss eGZzLDY0LDEscmFuZHJlYWQsNGssMSw2NTEzNjcuMjc1NSw2NzAwMDguNDk5NCwyLjg2MiUNCnN5 bmMsbnVsbF9ibGsseGZzLDY0LDEscmFuZHJlYWQsNGssMiw2NTI2MjEuNDU4Niw2NjgwNzQuNzMw OCwyLjM2OCUNCnN5bmMsbnVsbF9ibGsseGZzLDEsNjQscmFuZHJlYWQsNGssMSwzOTk4MjUuOTcy NSw0MTAyMTkuMjU5NCwyLjU5OSUNCnN5bmMsbnVsbF9ibGsseGZzLDEsNjQscmFuZHJlYWQsNGss Miw0MDEwNTQuMjMxNSw0MDgzNTkuMjg4LDEuODIxJQ0Kc3luYyxudWxsX2Jsayx4ZnMsNjQsNjQs cmFuZHJlYWQsNGssMSw2NDkzMzAuOTQ0Niw2NjE3MjAuMjUyLDEuOTA4JQ0Kc3luYyxudWxsX2Js ayx4ZnMsNjQsNjQscmFuZHJlYWQsNGssMiw2NTE4MDAuMDA2Nyw2Njg1ODAuNTc1MywyLjU3NCUN CmxpYmFpbyxudWxsX2Jsayx4ZnMsMSwxLHJhbmRyZWFkLDRrLDEsMzQ1ODA0LjE3MzIsMzUzNDQ2 Ljk1MTgsMi4yMTAlDQpsaWJhaW8sbnVsbF9ibGsseGZzLDEsMSxyYW5kcmVhZCw0aywyLDM0NzAx OS41OTkzLDM1Mzg0Mi4xNzE5LDEuOTY2JQ0KbGliYWlvLG51bGxfYmxrLHhmcyw2NCwxLHJhbmRy ZWFkLDRrLDEsNjQ0MjM3LjIyNTQsNjYxMDIwLjY2NiwyLjYwNSUNCmxpYmFpbyxudWxsX2Jsayx4 ZnMsNjQsMSxyYW5kcmVhZCw0aywyLDY0MzYzOC4xMjQxLDY2MjMzMy44Nzc3LDIuOTA1JQ0KbGli YWlvLG51bGxfYmxrLHhmcywxLDY0LHJhbmRyZWFkLDRrLDEsMzQ1Mjg2LjQ1NzEsMzUxOTgyLjQ2 NzMsMS45MzklDQpsaWJhaW8sbnVsbF9ibGsseGZzLDEsNjQscmFuZHJlYWQsNGssMiwzNDUyOTAu OTU3LDM1MjE3OS4xMjc0LDEuOTk1JQ0KbGliYWlvLG51bGxfYmxrLHhmcyw2NCw2NCxyYW5kcmVh ZCw0aywxLDY0MTI5Ni40ODAyLDY1OTkyNS43MzU4LDIuOTA1JQ0KbGliYWlvLG51bGxfYmxrLHhm cyw2NCw2NCxyYW5kcmVhZCw0aywyLDY0Mjg2NS43NzExLDY1OTY2My45ODkxLDIuNjEzJQ0KaW9f dXJpbmcsbnVsbF9ibGsseGZzLDEsMSxyYW5kd3JpdGUsNGssMSwzNDE0MjIuNTE5MiwzNDYzODEu ODg3MywxLjQ1MyUNCmlvX3VyaW5nLG51bGxfYmxrLHhmcywxLDEscmFuZHdyaXRlLDRrLDIsMzQx Nzg5LjQ3MzcsMzQ1MzkxLjEyMDMsMS4wNTQlDQppb191cmluZyxudWxsX2Jsayx4ZnMsNjQsMSxy YW5kd3JpdGUsNGssMSw1ODI3OTIuNzgwNSw1ODk4NDguMjc2OCwxLjIxMSUNCmlvX3VyaW5nLG51 bGxfYmxrLHhmcyw2NCwxLHJhbmR3cml0ZSw0aywyLDU4MzY5NC40MjA0LDU4Njk5MC4zMzQsMC41 NjUlDQppb191cmluZyxudWxsX2Jsayx4ZnMsMSw2NCxyYW5kd3JpdGUsNGssMSwzMzY4MTIuNzM5 NiwzMzY2NzcuOTc3NCwtMC4wNDAlDQppb191cmluZyxudWxsX2Jsayx4ZnMsMSw2NCxyYW5kd3Jp dGUsNGssMiwzMzU2MTAuNTc5NiwzMzQzNDQuNDg4NSwtMC4zNzclDQppb191cmluZyxudWxsX2Js ayx4ZnMsNjQsNjQscmFuZHdyaXRlLDRrLDEsMzYwNzc4LjM4MTEsMzU3NTA4LjAyOCwtMC45MDYl DQppb191cmluZyxudWxsX2Jsayx4ZnMsNjQsNjQscmFuZHdyaXRlLDRrLDIsMzU5ODk4LjIwMTIs MzU4ODg1LjczOSwtMC4yODElDQpzeW5jLG51bGxfYmxrLHhmcywxLDEscmFuZHdyaXRlLDRrLDEs MzQ4NjA0LjIxMzIsMzU1NjU1LjExMTUsMi4wMjMlDQpzeW5jLG51bGxfYmxrLHhmcywxLDEscmFu ZHdyaXRlLDRrLDIsMzUwMzU1Ljk4ODEsMzUyNzYzLjM0MTIsMC42ODclDQpzeW5jLG51bGxfYmxr LHhmcyw2NCwxLHJhbmR3cml0ZSw0aywxLDU4NTE1OC4wNTYxLDU5MTcxMy40MDk2LDEuMTIwJQ0K c3luYyxudWxsX2Jsayx4ZnMsNjQsMSxyYW5kd3JpdGUsNGssMiw1ODUxNzguNjYwNyw1OTMxMzMu MzkxMSwxLjM1OSUNCnN5bmMsbnVsbF9ibGsseGZzLDEsNjQscmFuZHdyaXRlLDRrLDEsMzUxOTky LjYzMzYsMzU2MzMyLjcyMjIsMS4yMzMlDQpzeW5jLG51bGxfYmxrLHhmcywxLDY0LHJhbmR3cml0 ZSw0aywyLDM1MTkxNC44Njk1LDM1NjEwNC4yOTY1LDEuMTkwJQ0Kc3luYyxudWxsX2Jsayx4ZnMs NjQsNjQscmFuZHdyaXRlLDRrLDEsNTg0NzE0LjcxOSw1ODY3NjQuMzgyNCwwLjM1MSUNCnN5bmMs bnVsbF9ibGsseGZzLDY0LDY0LHJhbmR3cml0ZSw0aywyLDU4MDU3OC4wODA3LDU4NjUwOC4zMzI4 LDEuMDIxJQ0KbGliYWlvLG51bGxfYmxrLHhmcywxLDEscmFuZHdyaXRlLDRrLDEsMzA5NDYzLjE1 MTIsMzE0NTY3LjE4MTEsMS42NDklDQpsaWJhaW8sbnVsbF9ibGsseGZzLDEsMSxyYW5kd3JpdGUs NGssMiwzMDg3ODYuMjczOCwzMTQyNDIuMDU4NiwxLjc2NyUNCmxpYmFpbyxudWxsX2Jsayx4ZnMs NjQsMSxyYW5kd3JpdGUsNGssMSw1ODY4NDQuNTQzNyw1OTY4NjAuMDA0NywxLjcwNyUNCmxpYmFp byxudWxsX2Jsayx4ZnMsNjQsMSxyYW5kd3JpdGUsNGssMiw1ODcyMTguNTg1NCw1OTQxNDkuMzg1 MSwxLjE4MCUNCmxpYmFpbyxudWxsX2Jsayx4ZnMsMSw2NCxyYW5kd3JpdGUsNGssMSwzMDMwMTAu ODMzLDMwNzcwMC44NDMzLDEuNTQ4JQ0KbGliYWlvLG51bGxfYmxrLHhmcywxLDY0LHJhbmR3cml0 ZSw0aywyLDMwMjg3NC45NzA4LDMwNjgxMS40NzMsMS4zMDAlDQpsaWJhaW8sbnVsbF9ibGsseGZz LDY0LDY0LHJhbmR3cml0ZSw0aywxLDU4MDY3Mi4wMjE5LDU4ODE2Ny43NTU1LDEuMjkxJQ0KbGli YWlvLG51bGxfYmxrLHhmcyw2NCw2NCxyYW5kd3JpdGUsNGssMiw1ODU4OTQuNjAzNSw1OTAxMTMu NTI5NSwwLjcyMCUNCmlvX3VyaW5nLG51bGxfYmxrLHhmcywxLDEscmVhZCw0aywxLDQ4NTk5Mi4z NjY5LDQ5NzIxMS4zOTMsMi4zMDglDQppb191cmluZyxudWxsX2Jsayx4ZnMsMSwxLHJlYWQsNGss Miw0ODU3MzEuMjc1Niw0OTYyNDEuMzkyLDIuMTY0JQ0KaW9fdXJpbmcsbnVsbF9ibGsseGZzLDY0 LDEscmVhZCw0aywxLDEzODY3NTQuMzUsMTQyMjcxMC42ODYsMi41OTMlDQppb191cmluZyxudWxs X2Jsayx4ZnMsNjQsMSxyZWFkLDRrLDIsMTM4MzkzMi41MzgsMTQzODczMC41NTEsMy45NjAlDQpp b191cmluZyxudWxsX2Jsayx4ZnMsMSw2NCxyZWFkLDRrLDEsNDg1NjU3Ljg0NDcsNDk4Mjc2LjEy NDEsMi41OTglDQppb191cmluZyxudWxsX2Jsayx4ZnMsMSw2NCxyZWFkLDRrLDIsNDg4NjEyLjI0 NjMsNDk3MzM5LjE1NTQsMS43ODYlDQppb191cmluZyxudWxsX2Jsayx4ZnMsNjQsNjQscmVhZCw0 aywxLDEzNzEwODMuNjMxLDE0MjYxOTguNDEzLDQuMDIwJQ0KaW9fdXJpbmcsbnVsbF9ibGsseGZz LDY0LDY0LHJlYWQsNGssMiwxMzc1ODU5LjEwOSwxNDE0ODI3LjMxNywyLjgzMiUNCnN5bmMsbnVs bF9ibGsseGZzLDEsMSxyZWFkLDRrLDEsNTMzNDc3LjYxNzQsNTUxODM5LjQzODcsMy40NDIlDQpz eW5jLG51bGxfYmxrLHhmcywxLDEscmVhZCw0aywyLDUzMzQ5Mi4yNTAzLDU1MDM1OC45ODgsMy4x NjIlDQpzeW5jLG51bGxfYmxrLHhmcyw2NCwxLHJlYWQsNGssMSwxMzQxOTY1LjEzNiwxNDM1MzQw LjAxMSw2Ljk1OCUNCnN5bmMsbnVsbF9ibGsseGZzLDY0LDEscmVhZCw0aywyLDEzODkxNDcuODks MTQ0NzYyNi4wNTgsNC4yMTAlDQpzeW5jLG51bGxfYmxrLHhmcywxLDY0LHJlYWQsNGssMSw1MzI4 MTkuMDM5NCw1NDk5MTIuMzY5NiwzLjIwOCUNCnN5bmMsbnVsbF9ibGsseGZzLDEsNjQscmVhZCw0 aywyLDUzMjMwMy44ODk5LDU0ODcxNS43NDI4LDMuMDgzJQ0Kc3luYyxudWxsX2Jsayx4ZnMsNjQs NjQscmVhZCw0aywxLDEzNzY3MjIuMDg1LDE0NDgxMDcuNzI2LDUuMTg1JQ0Kc3luYyxudWxsX2Js ayx4ZnMsNjQsNjQscmVhZCw0aywyLDEzODg1NTMuNTYzLDE0NDc0NjIuMTAzLDQuMjQyJQ0KbGli YWlvLG51bGxfYmxrLHhmcywxLDEscmVhZCw0aywxLDQyNDY4MC41MTA3LDQzODQ2Ni4yODQ1LDMu MjQ2JQ0KbGliYWlvLG51bGxfYmxrLHhmcywxLDEscmVhZCw0aywyLDQyNTc1MC4zMDgzLDQzMzc4 MC43NDA2LDEuODg2JQ0KbGliYWlvLG51bGxfYmxrLHhmcyw2NCwxLHJlYWQsNGssMSwxMzU4NDgz LjEzNCwxNDE3NzM0LjExOCw0LjM2MiUNCmxpYmFpbyxudWxsX2Jsayx4ZnMsNjQsMSxyZWFkLDRr LDIsMTM2MzU5OS41NiwxNDIzNjYwLjM4OSw0LjQwNSUNCmxpYmFpbyxudWxsX2Jsayx4ZnMsMSw2 NCxyZWFkLDRrLDEsNDIxOTU0LjMzNDksNDM1OTIwLjIwMjcsMy4zMTAlDQpsaWJhaW8sbnVsbF9i bGsseGZzLDEsNjQscmVhZCw0aywyLDQyMTIwNy42MjY0LDQzNjQ4MC45MTczLDMuNjI2JQ0KbGli YWlvLG51bGxfYmxrLHhmcyw2NCw2NCxyZWFkLDRrLDEsMTM2MDY3MC4zNTUsMTQxODc1My4wNDIs NC4yNjklDQpsaWJhaW8sbnVsbF9ibGsseGZzLDY0LDY0LHJlYWQsNGssMiwxMzQ5ODI4LjMwNiwx NDEyODg5Ljk0MSw0LjY3MiUNCmlvX3VyaW5nLG51bGxfYmxrLHhmcywxLDEsd3JpdGUsNGssMSwz ODYwOTYuMzYzNSwzOTQ2NzAuMjExLDIuMjIxJQ0KaW9fdXJpbmcsbnVsbF9ibGsseGZzLDEsMSx3 cml0ZSw0aywyLDM4OTgwNC4wMzk5LDM5NDI2My42MjQ1LDEuMTQ0JQ0KaW9fdXJpbmcsbnVsbF9i bGsseGZzLDY0LDEsd3JpdGUsNGssMSw5MTg0NTYuNTAyOSw5MjE2ODYuOTg3NSwwLjM1MiUNCmlv X3VyaW5nLG51bGxfYmxrLHhmcyw2NCwxLHdyaXRlLDRrLDIsODkyNzc5LjA4MTQsOTEyMzU3LjI0 MjksMi4xOTMlDQppb191cmluZyxudWxsX2Jsayx4ZnMsMSw2NCx3cml0ZSw0aywxLDM4NTM5OS45 MiwzOTM2MTYuMDc5NSwyLjEzMiUNCmlvX3VyaW5nLG51bGxfYmxrLHhmcywxLDY0LHdyaXRlLDRr LDIsMzg2MzIzLjc4OTIsMzkzNTUwLjE4MTcsMS44NzElDQppb191cmluZyxudWxsX2Jsayx4ZnMs NjQsNjQsd3JpdGUsNGssMSwzNzQ5NjguMjg3OCwzODI2MzIuNTUzOCwyLjA0NCUNCmlvX3VyaW5n LG51bGxfYmxrLHhmcyw2NCw2NCx3cml0ZSw0aywyLDM3NzQ2OC41NzIsMzgxNTI4LjA3NzUsMS4w NzUlDQpzeW5jLG51bGxfYmxrLHhmcywxLDEsd3JpdGUsNGssMSw0MTk0MDMuNjUzMiw0Mjg1Nzgu NTE0MSwyLjE4OCUNCnN5bmMsbnVsbF9ibGsseGZzLDEsMSx3cml0ZSw0aywyLDQxOTgxMy4zMzk2 LDQyOTA1Ny41NjQ3LDIuMjAyJQ0Kc3luYyxudWxsX2Jsayx4ZnMsNjQsMSx3cml0ZSw0aywxLDkw NjA1Ny43Mjk1LDkyMDUzMi4wOTc5LDEuNTk4JQ0Kc3luYyxudWxsX2Jsayx4ZnMsNjQsMSx3cml0 ZSw0aywyLDkyMjcxMC44MTkzLDkxMjk4NC4yMzM5LC0xLjA1NCUNCnN5bmMsbnVsbF9ibGsseGZz LDEsNjQsd3JpdGUsNGssMSw0MjAwOTAuNzk3LDQyNjQwNi44MTk4LDEuNTAzJQ0Kc3luYyxudWxs X2Jsayx4ZnMsMSw2NCx3cml0ZSw0aywyLDQxNzEyMi40MjkzLDQyOTAxMC45NjYzLDIuODUwJQ0K c3luYyxudWxsX2Jsayx4ZnMsNjQsNjQsd3JpdGUsNGssMSw4NzA5NTUuNjAxNSw5MTc5OTEuODAw NSw1LjQwMSUNCnN5bmMsbnVsbF9ibGsseGZzLDY0LDY0LHdyaXRlLDRrLDIsODY5MzA1LjI0NjMs ODk3NzgxLjgxNDUsMy4yNzYlDQpsaWJhaW8sbnVsbF9ibGsseGZzLDEsMSx3cml0ZSw0aywxLDM0 NjU3Mi4xNDc2LDM1NTI3OC4yNTc0LDIuNTEyJQ0KbGliYWlvLG51bGxfYmxrLHhmcywxLDEsd3Jp dGUsNGssMiwzNDY4NTkuNzcxMywzNTQ3OTUuMDA2OCwyLjI4OCUNCmxpYmFpbyxudWxsX2Jsayx4 ZnMsNjQsMSx3cml0ZSw0aywxLDg5MTE1Mi40MjMyLDkxMTk0MC41MzczLDIuMzMzJQ0KbGliYWlv LG51bGxfYmxrLHhmcyw2NCwxLHdyaXRlLDRrLDIsODk4MzYxLjM3NTksOTI0NDA0LjM3MywyLjg5 OSUNCmxpYmFpbyxudWxsX2Jsayx4ZnMsMSw2NCx3cml0ZSw0aywxLDM0NTQ3Ni45NTA4LDM1MTUw Ni44NDk4LDEuNzQ1JQ0KbGliYWlvLG51bGxfYmxrLHhmcywxLDY0LHdyaXRlLDRrLDIsMzQ2MDMx LjY5ODksMzUxMTgxLjIyNzMsMS40ODglDQpsaWJhaW8sbnVsbF9ibGsseGZzLDY0LDY0LHdyaXRl LDRrLDEsOTA5NTc5LjkyOCw5MDk3NzcuODQ4MSwwLjAyMiUNCmxpYmFpbyxudWxsX2Jsayx4ZnMs NjQsNjQsd3JpdGUsNGssMiw5Mjc4ODIuNTQxMiw5NTI3NjMuOTQ5MSwyLjY4MiUNCg== --00000000000087c6740640d8117c Content-Type: text/csv; charset="US-ASCII"; name="fio_results.csv" Content-Disposition: attachment; filename="fio_results.csv" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_mgllruz61 ZW5naW5lLG1lZGl1bSxmc19vcl9yYXcsbnVtam9icyxxZGVwdGgscGF0dGVybixicyxyZXBlYXRf aWQsSU9QUyxuZXdfSU9QUyxkaWZmDQppb191cmluZyxleHQ0LGZzLDEsMSxyYW5kd3JpdGUsNGss MSwxMTU4NjcuNTE4OSwxMTU2NjYuMDIyMiwtMC4xNzQlDQppb191cmluZyxleHQ0LGZzLDEsMSxy YW5kd3JpdGUsNGssMiwxMTU4MDMuNzY5OSwxMTU0NTkuOTI1NywtMC4yOTclDQppb191cmluZyxl eHQ0LGZzLDEsMSxyYW5kd3JpdGUsNGssMywxMDA0NzcuOTQyLDk5OTc5LjAxNzAyLC0wLjQ5NyUN CmlvX3VyaW5nLGV4dDQsZnMsMSwxLHJhbmR3cml0ZSw0ayw0LDEwMDQ4NC42MjUzLDk5ODI5LjUx OTUxLC0wLjY1MiUNCmlvX3VyaW5nLGV4dDQsZnMsNjQsMSxyYW5kd3JpdGUsNGssMSw1MDM2MDYu NzAzLDUwNDQwMS4zNywwLjE1OCUNCmlvX3VyaW5nLGV4dDQsZnMsNjQsMSxyYW5kd3JpdGUsNGss Miw1MDI3NzcuODA3NCw0OTU3OTYuNDM2NywtMS4zODklDQppb191cmluZyxleHQ0LGZzLDY0LDEs cmFuZHdyaXRlLDRrLDMsNTE2MDc3LjA0NzQsNTA4MzAxLjU4OTksLTEuNTA3JQ0KaW9fdXJpbmcs ZXh0NCxmcyw2NCwxLHJhbmR3cml0ZSw0ayw0LDUwNzk5NC4xMDAyLDUxOTM5Mi42MzY5LDIuMjQ0 JQ0KaW9fdXJpbmcsZXh0NCxmcywxLDY0LHJhbmR3cml0ZSw0aywxLDI4MTE4Ni40MTM2LDI4MDQ1 Ni40MjU3LC0wLjI2MCUNCmlvX3VyaW5nLGV4dDQsZnMsMSw2NCxyYW5kd3JpdGUsNGssMiwyNzk2 OTEuMjg4NSwyNzkzOTIuNTQzNSwtMC4xMDclDQppb191cmluZyxleHQ0LGZzLDEsNjQscmFuZHdy aXRlLDRrLDMsMzQ3NTU4LjA5MDcsMzQ1ODMzLjA2OTQsLTAuNDk2JQ0KaW9fdXJpbmcsZXh0NCxm cywxLDY0LHJhbmR3cml0ZSw0ayw0LDM0NjU1MC43OTA4LDM0NDc3OC41NzA0LC0wLjUxMSUNCmlv X3VyaW5nLGV4dDQsZnMsNjQsNjQscmFuZHdyaXRlLDRrLDEsNTEwOTA5LjU3MTEsNTEyMzAzLjQ5 OTQsMC4yNzMlDQppb191cmluZyxleHQ0LGZzLDY0LDY0LHJhbmR3cml0ZSw0aywyLDUxMzE5MS44 OTgyLDUxMDk2Mi4zMzk2LC0wLjQzNCUNCmlvX3VyaW5nLGV4dDQsZnMsNjQsNjQscmFuZHdyaXRl LDRrLDMsNTA3MzU1LjAyNDIsNTA2MjUzLjU0MTEsLTAuMjE3JQ0KaW9fdXJpbmcsZXh0NCxmcyw2 NCw2NCxyYW5kd3JpdGUsNGssNCw0OTg3MzkuMDU1OCw1MTAwODAuNTU0NiwyLjI3NCUNCnN5bmMs ZXh0NCxmcywxLDEscmFuZHdyaXRlLDRrLDEsMTI2NzA4LjMzODIsMTI2NjE4LjcyMywtMC4wNzEl DQpzeW5jLGV4dDQsZnMsMSwxLHJhbmR3cml0ZSw0aywyLDEyNjQzOC40NzYsMTI2OTQ2LjQ2NzYs MC40MDIlDQpzeW5jLGV4dDQsZnMsMSwxLHJhbmR3cml0ZSw0aywzLDExMTMyNS44Mjc5LDExMTE2 Ny43OTcyLC0wLjE0MiUNCnN5bmMsZXh0NCxmcywxLDEscmFuZHdyaXRlLDRrLDQsMTExNjMyLjQ3 MjgsMTExMDMxLjIzMjgsLTAuNTM5JQ0Kc3luYyxleHQ0LGZzLDY0LDEscmFuZHdyaXRlLDRrLDEs NTExOTAzLjI2OTksNTE0Mjg2LjkyMzgsMC40NjYlDQpzeW5jLGV4dDQsZnMsNjQsMSxyYW5kd3Jp dGUsNGssMiw1MTEzNjguNzY0OSw1MTI2MzMuNTk1NSwwLjI0NyUNCnN5bmMsZXh0NCxmcyw2NCwx LHJhbmR3cml0ZSw0aywzLDUxMjk5NS41MzM0LDUwODg1OC40MjE0LC0wLjgwNiUNCnN5bmMsZXh0 NCxmcyw2NCwxLHJhbmR3cml0ZSw0ayw0LDUxMTM0Ny44ODg0LDUwNDY2MC44NzgsLTEuMzA4JQ0K c3luYyxleHQ0LGZzLDEsNjQscmFuZHdyaXRlLDRrLDEsMTI2NDU5Ljg0MjMsMTI2NjI2LjU4OTYs MC4xMzIlDQpzeW5jLGV4dDQsZnMsMSw2NCxyYW5kd3JpdGUsNGssMiwxMjY0ODkuMjI1MiwxMjY1 NzguMzQwNCwwLjA3MCUNCnN5bmMsZXh0NCxmcywxLDY0LHJhbmR3cml0ZSw0aywzLDExMTY0MC4w MDYsMTExMDcwLjk4MjIsLTAuNTEwJQ0Kc3luYyxleHQ0LGZzLDEsNjQscmFuZHdyaXRlLDRrLDQs MTExNDI3LjM5MjksMTExMTg5LjIxMzUsLTAuMjE0JQ0Kc3luYyxleHQ0LGZzLDY0LDY0LHJhbmR3 cml0ZSw0aywxLDUwMzM5MS40NDM1LDUxNDkwOS4xMTgyLDIuMjg4JQ0Kc3luYyxleHQ0LGZzLDY0 LDY0LHJhbmR3cml0ZSw0aywyLDUwMjI0MS40NDYsNTEyMTM0Ljg3ODgsMS45NzAlDQpzeW5jLGV4 dDQsZnMsNjQsNjQscmFuZHdyaXRlLDRrLDMsNTA2OTc5LjUwMDcsNTA2OTgyLjgwMDYsMC4wMDEl DQpzeW5jLGV4dDQsZnMsNjQsNjQscmFuZHdyaXRlLDRrLDQsNTEwMTU1LjM5NzQsNTA3NTQ5Ljk2 NSwtMC41MTElDQpsaWJhaW8sZXh0NCxmcywxLDEscmFuZHdyaXRlLDRrLDEsMTEzNTEyLjQ3NDgs MTEyODEyLjY4NjUsLTAuNjE2JQ0KbGliYWlvLGV4dDQsZnMsMSwxLHJhbmR3cml0ZSw0aywyLDEx MzMwMy44OTQ5LDExMzIxNy4xNzk3LC0wLjA3NyUNCmxpYmFpbyxleHQ0LGZzLDEsMSxyYW5kd3Jp dGUsNGssMyw5ODE1My44MTQxLDk3MDY1LjgxNTU3LC0xLjEwOCUNCmxpYmFpbyxleHQ0LGZzLDEs MSxyYW5kd3JpdGUsNGssNCw5Nzg1NS4xODU3NSw5Nzg4MC4xNTIsMC4wMjYlDQpsaWJhaW8sZXh0 NCxmcyw2NCwxLHJhbmR3cml0ZSw0aywxLDUxNTEzMy40MTIyLDUwNzQzNC4wMzU1LC0xLjQ5NSUN CmxpYmFpbyxleHQ0LGZzLDY0LDEscmFuZHdyaXRlLDRrLDIsNTExMjEzLjIwOTYsNTA4NzMyLjQ4 NzgsLTAuNDg1JQ0KbGliYWlvLGV4dDQsZnMsNjQsMSxyYW5kd3JpdGUsNGssMyw1MTEzNjcuNjYw NSw1MDQ0MjAuODI2MywtMS4zNTglDQpsaWJhaW8sZXh0NCxmcyw2NCwxLHJhbmR3cml0ZSw0ayw0 LDUwNDYxMy41NDYyLDUxMDE1Ni4yNDQ4LDEuMDk4JQ0KbGliYWlvLGV4dDQsZnMsMSw2NCxyYW5k d3JpdGUsNGssMSwyNTU5NTkuNzM0LDI1NTY4My4zNzE5LC0wLjEwOCUNCmxpYmFpbyxleHQ0LGZz LDEsNjQscmFuZHdyaXRlLDRrLDIsMjU0NzcyLjE4NzEsMjUyMTQ4LjU5NzUsLTEuMDMwJQ0KbGli YWlvLGV4dDQsZnMsMSw2NCxyYW5kd3JpdGUsNGssMywzMTc3NjMuNzM3MywzMTU0OTYuNjQxNywt MC43MTMlDQpsaWJhaW8sZXh0NCxmcywxLDY0LHJhbmR3cml0ZSw0ayw0LDMxNjc2OC4xNzA1LDMx NjE1MS45NjQxLC0wLjE5NSUNCmxpYmFpbyxleHQ0LGZzLDY0LDY0LHJhbmR3cml0ZSw0aywxLDUw ODAwMy40NDk0LDUwOTYyOC42MDU3LDAuMzIwJQ0KbGliYWlvLGV4dDQsZnMsNjQsNjQscmFuZHdy aXRlLDRrLDIsNTA0NzIyLjU0NjIsNTAzNDYxLjAzMDgsLTAuMjUwJQ0KbGliYWlvLGV4dDQsZnMs NjQsNjQscmFuZHdyaXRlLDRrLDMsNTEwNjUyLjI0NzEsNTA4Mjc3LjEwODQsLTAuNDY1JQ0KbGli YWlvLGV4dDQsZnMsNjQsNjQscmFuZHdyaXRlLDRrLDQsNTExOTU0Ljg5MTYsNTAyMzU3Ljc5MDQs LTEuODc1JQ0KaW9fdXJpbmcsZXh0NCxmcywxLDEscmFuZHJlYWQsNGssMSwxODQ4Mi41NDE5Niwx ODQ5NC45MjUwOSwwLjA2NyUNCmlvX3VyaW5nLGV4dDQsZnMsMSwxLHJhbmRyZWFkLDRrLDIsMTg0 ODguMDQxODcsMTg0NTUuNzQyNCwtMC4xNzUlDQppb191cmluZyxleHQ0LGZzLDEsMSxyYW5kcmVh ZCw0aywzLDE4MDc1LjExNTQyLDE4MDk0LjgzMTc1LDAuMTA5JQ0KaW9fdXJpbmcsZXh0NCxmcywx LDEscmFuZHJlYWQsNGssNCwxODEwMC4wMzE2NywxODA5MS4yMzE4MSwtMC4wNDklDQppb191cmlu ZyxleHQ0LGZzLDY0LDEscmFuZHJlYWQsNGssMSwxMDA2OTYwLjk4NSwxMDAxNTM4Ljg5OSwtMC41 MzglDQppb191cmluZyxleHQ0LGZzLDY0LDEscmFuZHJlYWQsNGssMiwxMDA3MDU4LjYxNSwxMDAx NTU5LjA1NSwtMC41NDYlDQppb191cmluZyxleHQ0LGZzLDY0LDEscmFuZHJlYWQsNGssMywxMDA3 MDgxLjA2MywxMDAxNzc0LjAyNCwtMC41MjclDQppb191cmluZyxleHQ0LGZzLDY0LDEscmFuZHJl YWQsNGssNCwxMDA3MjkxLjUxOSwxMDAxNzI2Ljg0MiwtMC41NTIlDQppb191cmluZyxleHQ0LGZz LDEsNjQscmFuZHJlYWQsNGssMSw0MDE5NzYuNDAwNCw0MDgxNDEuMDQ3NiwxLjUzNCUNCmlvX3Vy aW5nLGV4dDQsZnMsMSw2NCxyYW5kcmVhZCw0aywyLDQwMTI0NC4zMTI2LDQwNjc1OS43MzczLDEu Mzc1JQ0KaW9fdXJpbmcsZXh0NCxmcywxLDY0LHJhbmRyZWFkLDRrLDMsNDIyODAzLjg2OTksNDIw MDEwLjI2NjUsLTAuNjYxJQ0KaW9fdXJpbmcsZXh0NCxmcywxLDY0LHJhbmRyZWFkLDRrLDQsNDI0 NTgwLjYwNyw0MjAzMTAuNDQ0OCwtMS4wMDYlDQppb191cmluZyxleHQ0LGZzLDY0LDY0LHJhbmRy ZWFkLDRrLDEsMjEzOTIwOC4zNiwyMTU4NDkxLjEzNCwwLjkwMSUNCmlvX3VyaW5nLGV4dDQsZnMs NjQsNjQscmFuZHJlYWQsNGssMiwyMjA5Nzc3LjEyNCwyMjMzOTk5LjIzMywxLjA5NiUNCmlvX3Vy aW5nLGV4dDQsZnMsNjQsNjQscmFuZHJlYWQsNGssMywyMjgxNDMzLjYxOSwyMzA5OTQwLjY2OSwx LjI1MCUNCmlvX3VyaW5nLGV4dDQsZnMsNjQsNjQscmFuZHJlYWQsNGssNCwyMzU5NTUxLjc1Miwy Mzg2MjU3LjgwOCwxLjEzMiUNCnN5bmMsZXh0NCxmcywxLDEscmFuZHJlYWQsNGssMSwxODQ3Ni4w NDIwNywxODQ4MC40OTE5OSwwLjAyNCUNCnN5bmMsZXh0NCxmcywxLDEscmFuZHJlYWQsNGssMiwx ODQ5My40NzUxMSwxODQ4Ni4wNDE5LC0wLjA0MCUNCnN5bmMsZXh0NCxmcywxLDEscmFuZHJlYWQs NGssMywxODExMS45NDgxMywxODA4My4xNDg2MSwtMC4xNTklDQpzeW5jLGV4dDQsZnMsMSwxLHJh bmRyZWFkLDRrLDQsMTgxMDMuOTMxNiwxODA5NS4yNDg0MSwtMC4wNDglDQpzeW5jLGV4dDQsZnMs NjQsMSxyYW5kcmVhZCw0aywxLDk5ODM1Mi4zNTQ5LDEwMDI4NzMuODA0LDAuNDUzJQ0Kc3luYyxl eHQ0LGZzLDY0LDEscmFuZHJlYWQsNGssMiw5OTgzNTkuNDM4LDEwMDI1ODUuNDgsMC40MjMlDQpz eW5jLGV4dDQsZnMsNjQsMSxyYW5kcmVhZCw0aywzLDk5ODQyOC4xNTk1LDEwMDI2NDEuNjc5LDAu NDIyJQ0Kc3luYyxleHQ0LGZzLDY0LDEscmFuZHJlYWQsNGssNCw5OTg1MzguMDQ4NywxMDAyNzQ1 LjA0MiwwLjQyMSUNCnN5bmMsZXh0NCxmcywxLDY0LHJhbmRyZWFkLDRrLDEsMTg0OTMuMjI1MTEs MTg0ODEuNjc1MzEsLTAuMDYyJQ0Kc3luYyxleHQ0LGZzLDEsNjQscmFuZHJlYWQsNGssMiwxODQ3 OC40NTg2OSwxODQ4My4xMjUyOCwwLjAyNSUNCnN5bmMsZXh0NCxmcywxLDY0LHJhbmRyZWFkLDRr LDMsMTgxMTEuOTQ4MTMsMTgwOTMuNTY1MTEsLTAuMTAxJQ0Kc3luYyxleHQ0LGZzLDEsNjQscmFu ZHJlYWQsNGssNCwxODEwNi43OTgyMiwxODA5Mi4wNjUxMywtMC4wODElDQpzeW5jLGV4dDQsZnMs NjQsNjQscmFuZHJlYWQsNGssMSw5OTg5MTcuMDE5NCwxMDAwMjc4LjkwMywwLjEzNiUNCnN5bmMs ZXh0NCxmcyw2NCw2NCxyYW5kcmVhZCw0aywyLDk5ODk0MC4zNjg3LDk5OTk4Mi4yMzQyLDAuMTA0 JQ0Kc3luYyxleHQ0LGZzLDY0LDY0LHJhbmRyZWFkLDRrLDMsOTk4OTEwLjYwMyw5OTk5NTcuMzAx NCwwLjEwNSUNCnN5bmMsZXh0NCxmcyw2NCw2NCxyYW5kcmVhZCw0ayw0LDk5OTIwNy4zMzk2LDEw MDAzOTcuMzQ3LDAuMTE5JQ0KbGliYWlvLGV4dDQsZnMsMSwxLHJhbmRyZWFkLDRrLDEsMTg0MTgu Mzc2MzYsMTg0MTcuMTU5NzEsLTAuMDA3JQ0KbGliYWlvLGV4dDQsZnMsMSwxLHJhbmRyZWFkLDRr LDIsMTg0MjAuNjI2MzIsMTg0MjYuMzI2MjMsMC4wMzElDQpsaWJhaW8sZXh0NCxmcywxLDEscmFu ZHJlYWQsNGssMywxODAxMC4yNjY1LDE4MDAzLjQ5OTk0LC0wLjAzOCUNCmxpYmFpbyxleHQ0LGZz LDEsMSxyYW5kcmVhZCw0ayw0LDE4MDA3LjIzMzIxLDE4MDAwLjg5OTk5LC0wLjAzNSUNCmxpYmFp byxleHQ0LGZzLDY0LDEscmFuZHJlYWQsNGssMSwxMDAxODM1LjIyMiwxMDAxMDc4LjM5NywtMC4w NzYlDQpsaWJhaW8sZXh0NCxmcyw2NCwxLHJhbmRyZWFkLDRrLDIsMTAwMTM5MC42MzcsMTAwMTI2 NC4yNDEsLTAuMDEzJQ0KbGliYWlvLGV4dDQsZnMsNjQsMSxyYW5kcmVhZCw0aywzLDEwMDE3NDIu MTk2LDEwMDExMjAuNjQ2LC0wLjA2MiUNCmxpYmFpbyxleHQ0LGZzLDY0LDEscmFuZHJlYWQsNGss NCwxMDAxMzk4LjEzNywxMDAxMzEyLjEwNiwtMC4wMDklDQpsaWJhaW8sZXh0NCxmcywxLDY0LHJh bmRyZWFkLDRrLDEsMzU4NDQ2LjM1OTIsMzYyNzQyLjY3MSwxLjE5OSUNCmxpYmFpbyxleHQ0LGZz LDEsNjQscmFuZHJlYWQsNGssMiwzNTg4MDUuMDE5OSwzNjE4NzEuMTg1NSwwLjg1NSUNCmxpYmFp byxleHQ0LGZzLDEsNjQscmFuZHJlYWQsNGssMywzODcxOTYuMDMwMSwzODQ5MjIuODUxMywtMC41 ODclDQpsaWJhaW8sZXh0NCxmcywxLDY0LHJhbmRyZWFkLDRrLDQsMzg3NjUwLjcyMjUsMzg0OTgw LjkxNywtMC42ODklDQpsaWJhaW8sZXh0NCxmcyw2NCw2NCxyYW5kcmVhZCw0aywxLDIzMDA4NTAu Nzg4LDIzODM1NzIuOTY0LDMuNTk1JQ0KbGliYWlvLGV4dDQsZnMsNjQsNjQscmFuZHJlYWQsNGss MiwyMzg0NDc4LjYzNCwyNDYwNjY1LjYxMSwzLjE5NSUNCmxpYmFpbyxleHQ0LGZzLDY0LDY0LHJh bmRyZWFkLDRrLDMsMjQ1NjY5OS45NzcsMjU0NDU2Ni40NTUsMy41NzclDQpsaWJhaW8sZXh0NCxm cyw2NCw2NCxyYW5kcmVhZCw0ayw0LDI1NDQwOTIuOTEyLDI2NDc5NzcuMDAxLDQuMDgzJQ0KaW9f dXJpbmcsZXh0NCxmcywxLDEsd3JpdGUsNGssMSwxMTk1NTguNDA3NCwxMTkzNDYuNDEwOSwtMC4x NzclDQppb191cmluZyxleHQ0LGZzLDEsMSx3cml0ZSw0aywyLDExOTQ4MS4yNzUzLDExOTk3My41 MzM4LDAuNDEyJQ0KaW9fdXJpbmcsZXh0NCxmcywxLDEsd3JpdGUsNGssMywxMDM0OTguNDQxNywx MDI5NzkuNTUwMywtMC41MDElDQppb191cmluZyxleHQ0LGZzLDEsMSx3cml0ZSw0ayw0LDEwMzIw Ni41OTY2LDEwMjkwMS42NjgzLC0wLjI5NSUNCmlvX3VyaW5nLGV4dDQsZnMsNjQsMSx3cml0ZSw0 aywxLDkxMzM5Ni4xODY4LDEwMDM5NTMuNzUyLDkuOTE0JQ0KaW9fdXJpbmcsZXh0NCxmcyw2NCwx LHdyaXRlLDRrLDIsOTI0NjY0LjY5NDUsMTA4NzYxMi43NDYsMTcuNjIyJQ0KaW9fdXJpbmcsZXh0 NCxmcyw2NCwxLHdyaXRlLDRrLDMsNzk3OTAyLjEzODIsODc0Mzk4LjM3MDEsOS41ODclDQppb191 cmluZyxleHQ0LGZzLDY0LDEsd3JpdGUsNGssNCw5MzI5NzUuMDUwOCwxMTM1Njk1LjYyNywyMS43 MjglDQppb191cmluZyxleHQ0LGZzLDEsNjQsd3JpdGUsNGssMSwzMDM5MDUuNTAxNiwzMDU0MDgu NDc2NSwwLjQ5NSUNCmlvX3VyaW5nLGV4dDQsZnMsMSw2NCx3cml0ZSw0aywyLDMwMzg2MS40MDIz LDMwNzM1My44Nzc0LDEuMTQ5JQ0KaW9fdXJpbmcsZXh0NCxmcywxLDY0LHdyaXRlLDRrLDMsMzg4 ODEzLjYwMzEsMzg2MjAyLjc4LC0wLjY3MSUNCmlvX3VyaW5nLGV4dDQsZnMsMSw2NCx3cml0ZSw0 ayw0LDM4OTUxMS40NzQ4LDM4NTQ3Ny42OTIsLTEuMDM2JQ0KaW9fdXJpbmcsZXh0NCxmcyw2NCw2 NCx3cml0ZSw0aywxLDg2NzIwMy4xNTk2LDg1NzQ2Ni4zNywtMS4xMjMlDQppb191cmluZyxleHQ0 LGZzLDY0LDY0LHdyaXRlLDRrLDIsODAwMTA5LjEzOTEsODI3Mjc2LjE0MzcsMy4zOTUlDQppb191 cmluZyxleHQ0LGZzLDY0LDY0LHdyaXRlLDRrLDMsODQ0MTMxLjQ2MTQsODM1OTI4LjI3MzgsLTAu OTcyJQ0KaW9fdXJpbmcsZXh0NCxmcyw2NCw2NCx3cml0ZSw0ayw0LDc3NDM3NS44MjA3LDc5NTU0 NS41NjIxLDIuNzM0JQ0Kc3luYyxleHQ0LGZzLDEsMSx3cml0ZSw0aywxLDEzMjg0OC44MDI1LDEz MjUwMy43NzQ5LC0wLjI2MCUNCnN5bmMsZXh0NCxmcywxLDEsd3JpdGUsNGssMiwxMzMwNzUuMDk4 NywxMzI3MTIuODIxNSwtMC4yNzIlDQpzeW5jLGV4dDQsZnMsMSwxLHdyaXRlLDRrLDMsMTE2NDcw Ljc5MjIsMTE2MDU2LjUxNTcsLTAuMzU2JQ0Kc3luYyxleHQ0LGZzLDEsMSx3cml0ZSw0ayw0LDEx NjU2OS45NDA1LDExNjA3Ni42OTg3LC0wLjQyMyUNCnN5bmMsZXh0NCxmcyw2NCwxLHdyaXRlLDRr LDEsOTcwMzcwLjgwNDMsOTY1MTUxLjk3ODMsLTAuNTM4JQ0Kc3luYyxleHQ0LGZzLDY0LDEsd3Jp dGUsNGssMiw4Njk4MjIuNzA4OSw4NDY5NTUuOTM0OCwtMi42MjklDQpzeW5jLGV4dDQsZnMsNjQs MSx3cml0ZSw0aywzLDg2ODQ4OS4zNzU1LDEwNTYxNTIuOTk1LDIxLjYwOCUNCnN5bmMsZXh0NCxm cyw2NCwxLHdyaXRlLDRrLDQsODAxODY1LjM4NzgsNzgzMDA3LjQ2NjMsLTIuMzUyJQ0Kc3luYyxl eHQ0LGZzLDEsNjQsd3JpdGUsNGssMSwxMzI4MjQuOTUyOSwxMzI3NTYuMjcwNywtMC4wNTIlDQpz eW5jLGV4dDQsZnMsMSw2NCx3cml0ZSw0aywyLDEzMjg2OS40MTg4LDEzMjY3OS40NTUzLC0wLjE0 MyUNCnN5bmMsZXh0NCxmcywxLDY0LHdyaXRlLDRrLDMsMTE2NTU5LjM0MDcsMTE1NzgzLjcyMDMs LTAuNjY1JQ0Kc3luYyxleHQ0LGZzLDEsNjQsd3JpdGUsNGssNCwxMTY2ODIuMzIyLDExNjAzOS40 MzI3LC0wLjU1MSUNCnN5bmMsZXh0NCxmcyw2NCw2NCx3cml0ZSw0aywxLDEwNDgwNDguMjQ4LDEw ODc1MzEuNTksMy43NjclDQpzeW5jLGV4dDQsZnMsNjQsNjQsd3JpdGUsNGssMiw4NzM1ODAuMDk3 Myw4Mzk0NzguNTg0OCwtMy45MDQlDQpzeW5jLGV4dDQsZnMsNjQsNjQsd3JpdGUsNGssMyw4NzY2 MTkuNTUyNCw4NzMzNTguMzIxNCwtMC4zNzIlDQpzeW5jLGV4dDQsZnMsNjQsNjQsd3JpdGUsNGss NCw4OTM4MDEuMDIzMyw5MjE1MjkuNDE1NywzLjEwMiUNCmxpYmFpbyxleHQ0LGZzLDEsMSx3cml0 ZSw0aywxLDExNzEwMi4zODE2LDExNzI2Ni41Mjg5LDAuMTQwJQ0KbGliYWlvLGV4dDQsZnMsMSwx LHdyaXRlLDRrLDIsMTE3MTU0LjcxNDEsMTE3Mjk2Ljc0NTEsMC4xMjElDQpsaWJhaW8sZXh0NCxm cywxLDEsd3JpdGUsNGssMywxMDA5OTMuNjMzNCwxMDA5MTMuMjg0OCwtMC4wODAlDQpsaWJhaW8s ZXh0NCxmcywxLDEsd3JpdGUsNGssNCwxMDEyNTIuNzI5MSwxMDA3NDkuMzA0MiwtMC40OTclDQps aWJhaW8sZXh0NCxmcyw2NCwxLHdyaXRlLDRrLDEsOTU4Mzk1Ljg3MDEsODkyNDEwLjE1OTgsLTYu ODg1JQ0KbGliYWlvLGV4dDQsZnMsNjQsMSx3cml0ZSw0aywyLDc5MTAzNy41MTYsODc4OTY1Ljg2 NzgsMTEuMTE2JQ0KbGliYWlvLGV4dDQsZnMsNjQsMSx3cml0ZSw0aywzLDk1Njc5Ny43NzM0LDEw NzU4MDcuMjA2LDEyLjQzOCUNCmxpYmFpbyxleHQ0LGZzLDY0LDEsd3JpdGUsNGssNCw5NTI1MDcu Njk5NywxMDM4MzgyLjQyMSw5LjAxNiUNCmxpYmFpbyxleHQ0LGZzLDEsNjQsd3JpdGUsNGssMSwy OTA2NzAuNTcyMiwyOTA2ODguMjA1MiwwLjAwNiUNCmxpYmFpbyxleHQ0LGZzLDEsNjQsd3JpdGUs NGssMiwyOTAwODkuNzY1MiwyOTA3NDguMTIwOSwwLjIyNyUNCmxpYmFpbyxleHQ0LGZzLDEsNjQs d3JpdGUsNGssMywzNjA5NDEuMjg0MywzNTc2MDQuNTM5OSwtMC45MjQlDQpsaWJhaW8sZXh0NCxm cywxLDY0LHdyaXRlLDRrLDQsMzYwNDM2LjgyNjEsMzU0MDUwLjI4MjUsLTEuNzcyJQ0KbGliYWlv LGV4dDQsZnMsNjQsNjQsd3JpdGUsNGssMSw4MDgzOTIuMzM1OSw4NzQxNzguMTk1OSw4LjEzOCUN CmxpYmFpbyxleHQ0LGZzLDY0LDY0LHdyaXRlLDRrLDIsMTAwMjE2My4yMiw5NDQ5NzUuODIxMSwt NS43MDYlDQpsaWJhaW8sZXh0NCxmcyw2NCw2NCx3cml0ZSw0aywzLDc2NDc2NS43OTQsODQzOTA0 Ljg0MjgsMTAuMzQ4JQ0KbGliYWlvLGV4dDQsZnMsNjQsNjQsd3JpdGUsNGssNCw4MDI2NjMuNjg5 Miw4MDA2OTUuOTk3MSwtMC4yNDUlDQppb191cmluZyxleHQ0LGZzLDEsMSxyZWFkLDRrLDEsOTM3 MzkuMzIxMDEsOTM5MjMuMDUxMjgsMC4xOTYlDQppb191cmluZyxleHQ0LGZzLDEsMSxyZWFkLDRr LDIsOTM3MzYuMzA0NCw5NDAzOC45OTkzNSwwLjMyMyUNCmlvX3VyaW5nLGV4dDQsZnMsMSwxLHJl YWQsNGssMyw4NDM5My44MjY3Nyw4NDczMS44MDQ0NywwLjQwMCUNCmlvX3VyaW5nLGV4dDQsZnMs MSwxLHJlYWQsNGssNCw4NDk4NS41MTY5MSw4NDYyMC4yODk2NiwtMC40MzAlDQppb191cmluZyxl eHQ0LGZzLDY0LDEscmVhZCw0aywxLDEwMDg4OTQuMzA0LDEwMDYzNjAuMjcxLC0wLjI1MSUNCmlv X3VyaW5nLGV4dDQsZnMsNjQsMSxyZWFkLDRrLDIsMTAwNjk3MC45NTEsMTAxMDA4MC44MTQsMC4z MDklDQppb191cmluZyxleHQ0LGZzLDY0LDEscmVhZCw0aywzLDk5OTI4My42OTA1LDEwMTA1ODQu MDgxLDEuMTMxJQ0KaW9fdXJpbmcsZXh0NCxmcyw2NCwxLHJlYWQsNGssNCwxMDA4NjY4LjMsOTk4 NzgzLjA1NzIsLTAuOTgwJQ0KaW9fdXJpbmcsZXh0NCxmcywxLDY0LHJlYWQsNGssMSw0MzczMzgu OTc3Nyw0NTA1MTMuNTI0OCwzLjAxMiUNCmlvX3VyaW5nLGV4dDQsZnMsMSw2NCxyZWFkLDRrLDIs NDM5NDY1LjI0MjIsNDUwMjcxLjUyODgsMi40NTklDQppb191cmluZyxleHQ0LGZzLDEsNjQscmVh ZCw0aywzLDQ1MjM5Mi4zOTM1LDQ0NzkyNi42MDEyLC0wLjk4NyUNCmlvX3VyaW5nLGV4dDQsZnMs MSw2NCxyZWFkLDRrLDQsNDUyODkyLjc2ODUsNDUwMzA3LjE3ODIsLTAuNTcxJQ0KaW9fdXJpbmcs ZXh0NCxmcyw2NCw2NCxyZWFkLDRrLDEsMjM5Mjg0OS41MDUsMjUwMDc0Ny4xNjMsNC41MDklDQpp b191cmluZyxleHQ0LGZzLDY0LDY0LHJlYWQsNGssMiwyMzg5ODk5LjMzNywyNjEyMjU3Ljc5MSw5 LjMwNCUNCmlvX3VyaW5nLGV4dDQsZnMsNjQsNjQscmVhZCw0aywzLDIzOTMxOTguMjkzLDI2MDk5 MTUuMjM4LDkuMDU2JQ0KaW9fdXJpbmcsZXh0NCxmcyw2NCw2NCxyZWFkLDRrLDQsMjM5MzI4Ni42 NzQsMjYwOTY2NC4zOTUsOS4wNDElDQpzeW5jLGV4dDQsZnMsMSwxLHJlYWQsNGssMSw5NDIwNS43 OTY1Nyw5NDM1My43Mjc0NCwwLjE1NyUNCnN5bmMsZXh0NCxmcywxLDEscmVhZCw0aywyLDk0MjI3 Ljc2Mjg3LDk0MTc5LjA2MzY4LC0wLjA1MiUNCnN5bmMsZXh0NCxmcywxLDEscmVhZCw0aywzLDg2 MzM3Ljg0NDM3LDg1NTM2LjgyNDM5LC0wLjkyOCUNCnN5bmMsZXh0NCxmcywxLDEscmVhZCw0ayw0 LDg2MzM5LjYyNzY3LDg1NTM3LjgyNDM3LC0wLjkyOSUNCnN5bmMsZXh0NCxmcyw2NCwxLHJlYWQs NGssMSw5ODgwMTcuOTgyNywxMDA4NDY5Ljk4NCwyLjA3MCUNCnN5bmMsZXh0NCxmcyw2NCwxLHJl YWQsNGssMiwxMDAyNTI1LjU0OSw5OTc4MzguODg4NywtMC40NjclDQpzeW5jLGV4dDQsZnMsNjQs MSxyZWFkLDRrLDMsMTAwNzA1NS41ODEsMTAwODY3Ny45MTEsMC4xNjElDQpzeW5jLGV4dDQsZnMs NjQsMSxyZWFkLDRrLDQsMTAwMDkxNy43ODcsOTkyNTk1LjA4MDIsLTAuODMyJQ0Kc3luYyxleHQ0 LGZzLDEsNjQscmVhZCw0aywxLDk0MjMwLjI3OTUsOTQzODcuMjQzNTUsMC4xNjclDQpzeW5jLGV4 dDQsZnMsMSw2NCxyZWFkLDRrLDIsOTQxODEuMDk2OTgsOTQzNjQuNjYwNTksMC4xOTUlDQpzeW5j LGV4dDQsZnMsMSw2NCxyZWFkLDRrLDMsODYyNzkuNjI4NjcsODU3MzMuODIxMSwtMC42MzMlDQpz eW5jLGV4dDQsZnMsMSw2NCxyZWFkLDRrLDQsODYxMzMuNzQ3NzcsODU2NTMuMjg5MTEsLTAuNTU4 JQ0Kc3luYyxleHQ0LGZzLDY0LDY0LHJlYWQsNGssMSwxMDA1MTU5LjAxMSwxMDA0MjU5LjMwOCwt MC4wOTAlDQpzeW5jLGV4dDQsZnMsNjQsNjQscmVhZCw0aywyLDEwMTQ1MDYuNzMzLDEwMTU4Mjcu MTI1LDAuMTMwJQ0Kc3luYyxleHQ0LGZzLDY0LDY0LHJlYWQsNGssMywxMDA0MzE5LjIwNiwxMDA0 MDkzLjAzLC0wLjAyMyUNCnN5bmMsZXh0NCxmcyw2NCw2NCxyZWFkLDRrLDQsMTAwNjg1MC45NTUs MTAxNDk5MC4xMzQsMC44MDglDQpsaWJhaW8sZXh0NCxmcywxLDEscmVhZCw0aywxLDkyNTA2LjE1 ODIzLDkyNTQ0LjcyNDI2LDAuMDQyJQ0KbGliYWlvLGV4dDQsZnMsMSwxLHJlYWQsNGssMiw5MjQ3 My45NzU0Myw5MjgwMS40NTMzMSwwLjM1NCUNCmxpYmFpbyxleHQ0LGZzLDEsMSxyZWFkLDRrLDMs ODI0NzMuNTkyMTEsODI2NjMuMTA1NjIsMC4yMzAlDQpsaWJhaW8sZXh0NCxmcywxLDEscmVhZCw0 ayw0LDgyNzE0LjgwNDc1LDgyNDk2LjQ1ODM5LC0wLjI2NCUNCmxpYmFpbyxleHQ0LGZzLDY0LDEs cmVhZCw0aywxLDk5NTM1Mi41MzgyLDEwMTIwMjEuMzMzLDEuNjc1JQ0KbGliYWlvLGV4dDQsZnMs NjQsMSxyZWFkLDRrLDIsMTAwMTI1Mi43NDIsMTAxMDgyNC44ODksMC45NTYlDQpsaWJhaW8sZXh0 NCxmcyw2NCwxLHJlYWQsNGssMywxMDA0MjE5Ljg3Niw5OTUyMzYuMjU4OCwtMC44OTUlDQpsaWJh aW8sZXh0NCxmcyw2NCwxLHJlYWQsNGssNCwxMDA4OTU1Ljk2OCw5OTcxMjYuMjEwNCwtMS4xNzIl DQpsaWJhaW8sZXh0NCxmcywxLDY0LHJlYWQsNGssMSwzODkzNjUuNTc3MiwzODk3ODguNzM2OSww LjEwOSUNCmxpYmFpbyxleHQ0LGZzLDEsNjQscmVhZCw0aywyLDM4ODM3My44NDM4LDM5MTQ2Ny4x OTIyLDAuNzk2JQ0KbGliYWlvLGV4dDQsZnMsMSw2NCxyZWFkLDRrLDMsNDA4NjQ5LjgyMjUsNDA0 MTAwLjA5ODMsLTEuMTEzJQ0KbGliYWlvLGV4dDQsZnMsMSw2NCxyZWFkLDRrLDQsNDA5MDMyLjQ0 OTUsNDA0Njk2LjYzODQsLTEuMDYwJQ0KbGliYWlvLGV4dDQsZnMsNjQsNjQscmVhZCw0aywxLDMw ODQ4NzAuNDczLDMxMTY0NTIuMDYxLDEuMDI0JQ0KbGliYWlvLGV4dDQsZnMsNjQsNjQscmVhZCw0 aywyLDMwNjY2MjYuNjg1LDMwOTE2MDkuOTAzLDAuODE1JQ0KbGliYWlvLGV4dDQsZnMsNjQsNjQs cmVhZCw0aywzLDMwOTg2MTMuMjI2LDMxMDEyNzcuNTUzLDAuMDg2JQ0KbGliYWlvLGV4dDQsZnMs NjQsNjQscmVhZCw0ayw0LDI4Njc1NTIuNzcyLDMwODAzMjguNCw3LjQyMCUNCg== --00000000000087c6740640d8117c-- From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id QFs9CfSz6WjPJAIAYBR5ng (envelope-from ) for ; Sat, 11 Oct 2025 01:33:40 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Sat, 11 Oct 2025 01:33:40 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v7OUN-000000074fc-1ddZ for hi@josie.lol; Sat, 11 Oct 2025 01:33:39 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A5D501A669FA for ; Sat, 11 Oct 2025 01:34:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B04B73FBB3; Sat, 11 Oct 2025 01:33:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="QeATIuYO" X-Original-To: io-uring@vger.kernel.org Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D1332B9A8 for ; Sat, 11 Oct 2025 01:33:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760146411; cv=none; b=SGky8xo9ApgcHwL685SEH8z/8spEFWdDfcNJIJxUONnd3MIBDJcF4ueaZ84+jeJPKLBsXX7fTWAaO/1vcNdyHRHgeJQC/eavBnHoOqgviCn3Jh+/jWSQCXh11oja1+0Y2b8WNQjpfOGBOfmpHLJmVL2f46eHqiVgntrhvh4mJuI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760146411; c=relaxed/simple; bh=FMRXqxPu0WQ5Ax5nNw0lt7BC+iqQTQtavFODzaAsDT8=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=VskG9qediEqvpmPYGXLrNAI+tX11hdShA+orEThQyowI/19Ej4P9rS32T60igyLN13kepwWG12sxYHWlYIGadfxNB/CiltXaKw1ZTbg1aa1oNETSZkezEQ3eZkBkofCtkE9S/WmF6W6WXu1cm+0NM72vIqBGESr3g8uW08nIqqQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=QeATIuYO; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-267facf9b58so15767095ad.2 for ; Fri, 10 Oct 2025 18:33:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1760146408; x=1760751208; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=d/dbVKML6jyfDJLg2rXlA//5YED8oSUDfIzTUJyF0qc=; b=QeATIuYOcV0Ubn5NJlFEQDCHZ0h28DOmhcI+7yCi3dTo2PHhSkNAMKrV4rHFhJVa3Q hRGRX4Dg5/FIGNviJ5G8oEgQGL12pWHXmMg4qZygXcKEA6yHqCENVu+3atCXPrv/RnXr w5/4sGoiCCQDhUzRDdY91lCQZ0hnDuY7v1e64/9vpk8XmCQz9/TgDeO2vk6dEyveCSJt xVP2wf1XwEEXlxeZWVousAUDWJeNSKpf9/zuB7YcW/YAUBgk1/N7yCTIFZs0o7qPbak0 BPb0ujZjAqJJEYVCm8b8W1c4A7iF2OuBdSdwUNK2EWst1hQAggSA0MzrARvvLXvPneyd zVqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760146408; x=1760751208; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=d/dbVKML6jyfDJLg2rXlA//5YED8oSUDfIzTUJyF0qc=; b=a2aQPQRjbDlr8aIb2ltl+49yZQHKsK8Rrqj1eARcBCUSGwkOAJFc/wq+X16rlR/Cr0 8EKxNdh6nVD65K7ApASe3/tFpheH8yC15rO4P7T3g7auzOdImolflNyZhQSpGvU+oxGx DtKsGF/gIxjSDIlnFMijwX/ttBsE6T+1IqQyKMGih0rLzjJnHvb7s5aMnUypXZY0N82B LX1PxnoR5wDGB8LOflTav9wiMNfb1GLzl7dxAKUqKIC9AIGNCX9UVK/oQ2pSLSTv5pwY nFV9L5A1sdzg8+TdCBmvm9VVOXCX/emLBxCrkgv7qGW257SJs4uvwXUHTg/W0t92im+D ZAuQ== X-Forwarded-Encrypted: i=1; AJvYcCWg3O7W+eto39Jc+32macNT/Lh0jVKEyHZeunOg/9EIXivVd5BUh7nXYRO8LEPYz3GQJhia/INwgg==@vger.kernel.org X-Gm-Message-State: AOJu0YxlKTaDezgIHW8rQHZiiV2HGY0kgnkZthqh+8Xdajq7roN/BIQo Ats6xp9sHN9kM9jUA7U2ErEcSrliBoa1Or+3PhSuE3te5c4FRydzrisPEW1Ht1Jza5w= X-Gm-Gg: ASbGncs+oo1DoZh78Szk4uTHMTzy1wPWs/J6zqjlZnWQYM+NtIAo9rcIChqiy4rxOTd 7c4LIcvfogzpJlZfNsGHmxD2F4En5neNWqrS7HFo/EpEtyFNrImrYXF48jdQPFkhq2UNqnV/Llo UBcnyt5FlDzLzEJxZE/a5SAuDLiU5cS1cy5SKLYWEqMhb+bB4tHhnFIFvGJadlRHxmpvDO4clT2 HEkxeLXTBsPdRai4FU2qP1X5urx7TFTkpyINtAeUWTtIX003DGb7YeLwmzua5RF204em4MMEKne MeTXJaiVnv44YRYfnQuq+rC/4T4oRVPxCSVMaCHuuEU4oaSw2nnP6PFxTJjj5Qjk+gjRF2L3tB5 b38HMXeKKc4Fca5TMKyDGuq4+RYTlLU0wTUErvDXs5GdTvU+9OnY6F43SAewieI3onInHGQs/DY IV/1IDDw== X-Google-Smtp-Source: AGHT+IH2ZLFZnAX+DFQkY9v0s+2anWfLJ5/4tgkkHlg3OcqGLJ41YRx4qbgQD3SYi5SqmtyxL/sNpg== X-Received: by 2002:a17:902:da8e:b0:26a:589b:cf11 with SMTP id d9443c01a7336-29027402d24mr204107925ad.43.1760146407559; Fri, 10 Oct 2025 18:33:27 -0700 (PDT) Received: from localhost.localdomain ([139.177.225.239]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b678ddc9f8esm3533310a12.10.2025.10.10.18.33.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 10 Oct 2025 18:33:27 -0700 (PDT) From: Fengnan Chang To: axboe@kernel.dk, viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, asml.silence@gmail.com, willy@infradead.org, djwong@kernel.org, hch@infradead.org, ritesh.list@gmail.com, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org Cc: Fengnan Chang Subject: [PATCH] block: enable per-cpu bio cache by default Date: Sat, 11 Oct 2025 09:33:12 +0800 Message-Id: <20251011013312.20698-1-changfengnan@bytedance.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='bytedance.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: bytedance.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.80.249 listed in list.dnswl.org] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 Per cpu bio cache was only used in the io_uring + raw block device, after commit 12e4e8c7ab59 ("io_uring/rw: enable bio caches for IRQ rw"), bio_put is safe for task and irq context, bio_alloc_bioset is safe for task context and no one calls in irq context, so we can enable per cpu bio cache by default. Benchmarked with t/io_uring and ext4+nvme: taskset -c 6 /root/fio/t/io_uring -p0 -d128 -b4096 -s1 -c1 -F1 -B1 -R1 -X1 -n1 -P1 /mnt/testfile base IOPS is 562K, patch IOPS is 574K. The CPU usage of bio_alloc_bioset decrease from 1.42% to 1.22%. The worst case is allocate bio in CPU A but free in CPU B, still use t/io_uring and ext4+nvme: base IOPS is 648K, patch IOPS is 647K. Also use fio test ext4/xfs with libaio/sync/io_uring on null_blk and nvme, no obvious performance regression. Signed-off-by: Fengnan Chang --- block/bio.c | 26 ++++++++++++-------------- block/blk-map.c | 4 ++++ block/fops.c | 4 ---- include/linux/fs.h | 3 --- io_uring/rw.c | 1 - 5 files changed, 16 insertions(+), 22 deletions(-) diff --git a/block/bio.c b/block/bio.c index 3b371a5da159..16b20c10cab7 100644 --- a/block/bio.c +++ b/block/bio.c @@ -513,20 +513,18 @@ struct bio *bio_alloc_bioset(struct block_device *bdev, unsigned short nr_vecs, if (WARN_ON_ONCE(!mempool_initialized(&bs->bvec_pool) && nr_vecs > 0)) return NULL; - if (opf & REQ_ALLOC_CACHE) { - if (bs->cache && nr_vecs <= BIO_INLINE_VECS) { - bio = bio_alloc_percpu_cache(bdev, nr_vecs, opf, - gfp_mask, bs); - if (bio) - return bio; - /* - * No cached bio available, bio returned below marked with - * REQ_ALLOC_CACHE to particpate in per-cpu alloc cache. - */ - } else { - opf &= ~REQ_ALLOC_CACHE; - } - } + opf |= REQ_ALLOC_CACHE; + if (bs->cache && nr_vecs <= BIO_INLINE_VECS) { + bio = bio_alloc_percpu_cache(bdev, nr_vecs, opf, + gfp_mask, bs); + if (bio) + return bio; + /* + * No cached bio available, bio returned below marked with + * REQ_ALLOC_CACHE to participate in per-cpu alloc cache. + */ + } else + opf &= ~REQ_ALLOC_CACHE; /* * submit_bio_noacct() converts recursion to iteration; this means if diff --git a/block/blk-map.c b/block/blk-map.c index 23e5d5ebe59e..570a7ca6edd1 100644 --- a/block/blk-map.c +++ b/block/blk-map.c @@ -255,6 +255,10 @@ static struct bio *blk_rq_map_bio_alloc(struct request *rq, { struct bio *bio; + /* + * Even REQ_ALLOC_CACHE is enabled by default, we still need this to + * mark bio is allocated by bio_alloc_bioset. + */ if (rq->cmd_flags & REQ_ALLOC_CACHE && (nr_vecs <= BIO_INLINE_VECS)) { bio = bio_alloc_bioset(NULL, nr_vecs, rq->cmd_flags, gfp_mask, &fs_bio_set); diff --git a/block/fops.c b/block/fops.c index ddbc69c0922b..090562a91b4c 100644 --- a/block/fops.c +++ b/block/fops.c @@ -177,8 +177,6 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, loff_t pos = iocb->ki_pos; int ret = 0; - if (iocb->ki_flags & IOCB_ALLOC_CACHE) - opf |= REQ_ALLOC_CACHE; bio = bio_alloc_bioset(bdev, nr_pages, opf, GFP_KERNEL, &blkdev_dio_pool); dio = container_of(bio, struct blkdev_dio, bio); @@ -326,8 +324,6 @@ static ssize_t __blkdev_direct_IO_async(struct kiocb *iocb, loff_t pos = iocb->ki_pos; int ret = 0; - if (iocb->ki_flags & IOCB_ALLOC_CACHE) - opf |= REQ_ALLOC_CACHE; bio = bio_alloc_bioset(bdev, nr_pages, opf, GFP_KERNEL, &blkdev_dio_pool); dio = container_of(bio, struct blkdev_dio, bio); diff --git a/include/linux/fs.h b/include/linux/fs.h index 601d036a6c78..18ec41732186 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -365,8 +365,6 @@ struct readahead_control; /* iocb->ki_waitq is valid */ #define IOCB_WAITQ (1 << 19) #define IOCB_NOIO (1 << 20) -/* can use bio alloc cache */ -#define IOCB_ALLOC_CACHE (1 << 21) /* * IOCB_DIO_CALLER_COMP can be set by the iocb owner, to indicate that the * iocb completion can be passed back to the owner for execution from a safe @@ -399,7 +397,6 @@ struct readahead_control; { IOCB_WRITE, "WRITE" }, \ { IOCB_WAITQ, "WAITQ" }, \ { IOCB_NOIO, "NOIO" }, \ - { IOCB_ALLOC_CACHE, "ALLOC_CACHE" }, \ { IOCB_DIO_CALLER_COMP, "CALLER_COMP" }, \ { IOCB_AIO_RW, "AIO_RW" }, \ { IOCB_HAS_METADATA, "AIO_HAS_METADATA" } diff --git a/io_uring/rw.c b/io_uring/rw.c index af5a54b5db12..fa7655ab9097 100644 --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -856,7 +856,6 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode, int rw_type) ret = kiocb_set_rw_flags(kiocb, rw->flags, rw_type); if (unlikely(ret)) return ret; - kiocb->ki_flags |= IOCB_ALLOC_CACHE; /* * If the file is marked O_NONBLOCK, still allow retry for it if it -- 2.39.5 (Apple Git-154) From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id iPimGf267WiLcw8AYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 02:52:45 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 02:52:45 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8V9Y-00000004Q3v-2x89 for hi@josie.lol; Tue, 14 Oct 2025 02:52:45 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DA3543A297F for ; Tue, 14 Oct 2025 02:52:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 67DBE22257E; Tue, 14 Oct 2025 02:52:42 +0000 (UTC) X-Original-To: stable@vger.kernel.org Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A911259CBC for ; Tue, 14 Oct 2025 02:52:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760410362; cv=none; b=qS7qJRFTi1YGSf0eCwhpb6zUWTt9jOWMl7P39ZKd3vBEbBRsM29Vcx3OOxNABGJsR46C9CGfOXeMEiSSU/g9R9yYLaRjTehSPRhxgvhdyM3tOaqWIFl+KtTXFUrGD0ZFfvQZ22PPpHZh5p4JBHsOJYq+yKYEgNNl2YJaO9rpaj8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760410362; c=relaxed/simple; bh=UC16EbPigLMsglPShN2aU4x4dx4S/ea9ol+vIvxK6bE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aMh2qDkSagqQq3oO+0CFGKB5KozFclaWRK2N97txyt9sZlBH3OBufzDeqH8z5n05FclPEiYYnd2Xf4siDEVK0Mxicnzs/uVV9zRa3cYUSZGPuUQCM1BhMQYlqFbVca+RmKkUSJqXC6KEOMCgB61wHS3xNcvHTSr869E4r3mDehc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-279e2554b6fso35551325ad.2 for ; Mon, 13 Oct 2025 19:52:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760410359; x=1761015159; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y3iEGPjTEMq28H494G3le/PpjY1d/gXwokrnXwTr0EA=; b=uPKF0pOAyvQDjgHi6P6rlqXBji7rK7aRLr1r+U74OLOeS8bnvaLvt5+rmu0Sh+g+A3 MUzyHtstKrMp9bxFswb/iEjyn4mkwFLYfRA7j+KL2aiw02SRqAgUuM4wI3vYaE11yQp9 C0kI+6ZIhULYS+EhQEoohdKD2rYSKnc8lQIQfpkvJH+tjSpi/l7Q4p992qUyQEmSvWgx IRoSRY2BjXWnjKQf6KVccbfonhNbobjylpKmnob06L4ARMsh7W6hnOJVoo3TWJdr/lx9 ZyFacgZzwtvx3ggWY4y6wY34mcgiqkvomcHwTZ1XcYiF1CDfW96b/wlCUiRjiAiOYOEX 0Slg== X-Gm-Message-State: AOJu0YwH0oLLbfoEuW9za3sWoF98p7pU46bi7kt5UNbtk6UrDVJIuGZm 7e/hIKI6vydrtrB41Kp65Fa3T3n6pquEV7o5yDI15rGsB8h16Rkrz1fpC3H0CEcs X-Gm-Gg: ASbGnctBoKvG9Wr111CAOAzNkHUlIZpTEKS8UlYKFR1jaurMYtHgDms9UdNj7Mx7ADZ 2H+TjYFglX5ylsH7Ry+nvgk4s93JrLS0+8gCPDDln/ZpjQkyrSAW3la2VYcdJ9ubLYgr2J6sjjA ELpunx1NjuhdyErWd6vvK3AuTYREiLG5fGzVOkN5S3SPN3WWf56Dl+8Yb5q9zbhxGdMFiGKlI6L IFMEIoR0/5gNKn70kNahAM8+QogzGPLZJp9wFfEe3jMgXskWJA3I6M512ZLC3WeO498V+ScyB1T v5qIirPH4XgvCrY1epA3ULiAorx2orlSr2CainvnvliV+vd2BIGEgXmmWpJGtoAJe46S8adDNlO CeGAJSUIFAMAo2imp/iF6VGJCGnOB3gJgbydWX/9FLswCAQcrKuZP X-Google-Smtp-Source: AGHT+IFJaPeb2N4JPYVpNkhASYoC4H+gIGNfYkAiyOPGfA7gyXdUEpvFwcG64zzIIMcO+f5GlwBDFA== X-Received: by 2002:a17:903:8c8:b0:264:a34c:c7f with SMTP id d9443c01a7336-290273568famr335713285ad.7.1760410359395; Mon, 13 Oct 2025 19:52:39 -0700 (PDT) Received: from EBJ9932692.tcent.cn ([2a11:3:200::202c]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29034f4ae6csm147933885ad.108.2025.10.13.19.52.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Oct 2025 19:52:38 -0700 (PDT) From: Lance Yang To: stable@vger.kernel.org Cc: linux-mm@kvack.org, ioworker0@gmail.com, Lance Yang , David Hildenbrand , Lorenzo Stoakes , Shuah Khan , Gabriel Krisman Bertazi , Andrew Morton Subject: [PATCH 6.6.y 1/1] selftests/mm: skip soft-dirty tests when CONFIG_MEM_SOFT_DIRTY is disabled Date: Tue, 14 Oct 2025 10:52:26 +0800 Message-ID: <20251014025226.35257-1-lance.yang@linux.dev> X-Mailer: git-send-email 2.49.0 In-Reply-To: <2025101329-unplanted-language-2cc7@gregkh> References: <2025101329-unplanted-language-2cc7@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -1.8 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.8 points) --- pts rule name description ---- ---------------------- ----------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: -17 From: Lance Yang The madv_populate and soft-dirty kselftests currently fail on systems where CONFIG_MEM_SOFT_DIRTY is disabled. Introduce a new helper softdirty_supported() into vm_util.c/h to ensure tests are properly skipped when the feature is not enabled. Link: https://lkml.kernel.org/r/20250917133137.62802-1-lance.yang@linux.dev Fixes: 9f3265db6ae8 ("selftests: vm: add test for Soft-Dirty PTE bit") Signed-off-by: Lance Yang Acked-by: David Hildenbrand Suggested-by: David Hildenbrand Cc: Lorenzo Stoakes Cc: Shuah Khan Cc: Gabriel Krisman Bertazi Cc: Signed-off-by: Andrew Morton (cherry picked from commit 0389c305ef56cbadca4cbef44affc0ec3213ed30) --- tools/testing/selftests/mm/madv_populate.c | 21 +----- tools/testing/selftests/mm/soft-dirty.c | 5 +- tools/testing/selftests/mm/vm_util.c | 77 ++++++++++++++++++++++ tools/testing/selftests/mm/vm_util.h | 1 + 4 files changed, 84 insertions(+), 20 deletions(-) diff --git a/tools/testing/selftests/mm/madv_populate.c b/tools/testing/selftests/mm/madv_populate.c index 17bcb07f19f3..7278623acf8c 100644 --- a/tools/testing/selftests/mm/madv_populate.c +++ b/tools/testing/selftests/mm/madv_populate.c @@ -264,23 +264,6 @@ static void test_softdirty(void) munmap(addr, SIZE); } -static int system_has_softdirty(void) -{ - /* - * There is no way to check if the kernel supports soft-dirty, other - * than by writing to a page and seeing if the bit was set. But the - * tests are intended to check that the bit gets set when it should, so - * doing that check would turn a potentially legitimate fail into a - * skip. Fortunately, we know for sure that arm64 does not support - * soft-dirty. So for now, let's just use the arch as a corse guide. - */ -#if defined(__aarch64__) - return 0; -#else - return 1; -#endif -} - int main(int argc, char **argv) { int nr_tests = 16; @@ -288,7 +271,7 @@ int main(int argc, char **argv) pagesize = getpagesize(); - if (system_has_softdirty()) + if (softdirty_supported()) nr_tests += 5; ksft_print_header(); @@ -300,7 +283,7 @@ int main(int argc, char **argv) test_holes(); test_populate_read(); test_populate_write(); - if (system_has_softdirty()) + if (softdirty_supported()) test_softdirty(); err = ksft_get_fail_cnt(); diff --git a/tools/testing/selftests/mm/soft-dirty.c b/tools/testing/selftests/mm/soft-dirty.c index 7dbfa53d93a0..7095b95d19ae 100644 --- a/tools/testing/selftests/mm/soft-dirty.c +++ b/tools/testing/selftests/mm/soft-dirty.c @@ -193,8 +193,11 @@ int main(int argc, char **argv) int pagesize; ksft_print_header(); - ksft_set_plan(15); + if (!softdirty_supported()) + ksft_exit_skip("soft-dirty is not support\n"); + + ksft_set_plan(15); pagemap_fd = open(PAGEMAP_FILE_PATH, O_RDONLY); if (pagemap_fd < 0) ksft_exit_fail_msg("Failed to open %s\n", PAGEMAP_FILE_PATH); diff --git a/tools/testing/selftests/mm/vm_util.c b/tools/testing/selftests/mm/vm_util.c index 558c9cd8901c..b2af70d75711 100644 --- a/tools/testing/selftests/mm/vm_util.c +++ b/tools/testing/selftests/mm/vm_util.c @@ -97,6 +97,42 @@ uint64_t read_pmd_pagesize(void) return strtoul(buf, NULL, 10); } +char *__get_smap_entry(void *addr, const char *pattern, char *buf, size_t len) +{ + int ret; + FILE *fp; + char *entry = NULL; + char addr_pattern[MAX_LINE_LENGTH]; + + ret = snprintf(addr_pattern, MAX_LINE_LENGTH, "%08lx-", + (unsigned long)addr); + if (ret >= MAX_LINE_LENGTH) + ksft_exit_fail_msg("%s: Pattern is too long\n", __func__); + + fp = fopen(SMAP_FILE_PATH, "r"); + if (!fp) + ksft_exit_fail_msg("%s: Failed to open file %s\n", __func__, + SMAP_FILE_PATH); + + if (!check_for_pattern(fp, addr_pattern, buf, len)) + goto err_out; + + /* Fetch the pattern in the same block */ + if (!check_for_pattern(fp, pattern, buf, len)) + goto err_out; + + /* Trim trailing newline */ + entry = strchr(buf, '\n'); + if (entry) + *entry = '\0'; + + entry = buf + strlen(pattern); + +err_out: + fclose(fp); + return entry; +} + bool __check_huge(void *addr, char *pattern, int nr_hpages, uint64_t hpage_size) { @@ -269,3 +305,44 @@ int uffd_unregister(int uffd, void *addr, uint64_t len) return ret; } + +static bool check_vmflag(void *addr, const char *flag) +{ + char buffer[MAX_LINE_LENGTH]; + const char *flags; + size_t flaglen; + + flags = __get_smap_entry(addr, "VmFlags:", buffer, sizeof(buffer)); + if (!flags) + ksft_exit_fail_msg("%s: No VmFlags for %p\n", __func__, addr); + + while (true) { + flags += strspn(flags, " "); + + flaglen = strcspn(flags, " "); + if (!flaglen) + return false; + + if (flaglen == strlen(flag) && !memcmp(flags, flag, flaglen)) + return true; + + flags += flaglen; + } +} + +bool softdirty_supported(void) +{ + char *addr; + bool supported = false; + const size_t pagesize = getpagesize(); + + /* New mappings are expected to be marked with VM_SOFTDIRTY (sd). */ + addr = mmap(0, pagesize, PROT_READ | PROT_WRITE, + MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); + if (!addr) + ksft_exit_fail_msg("mmap failed\n"); + + supported = check_vmflag(addr, "sd"); + munmap(addr, pagesize); + return supported; +} diff --git a/tools/testing/selftests/mm/vm_util.h b/tools/testing/selftests/mm/vm_util.h index 0c603bec5e20..9816d6e9bce6 100644 --- a/tools/testing/selftests/mm/vm_util.h +++ b/tools/testing/selftests/mm/vm_util.h @@ -51,6 +51,7 @@ int uffd_register(int uffd, void *addr, uint64_t len, int uffd_unregister(int uffd, void *addr, uint64_t len); int uffd_register_with_ioctls(int uffd, void *addr, uint64_t len, bool miss, bool wp, bool minor, uint64_t *ioctls); +bool softdirty_supported(void); /* * On ppc64 this will only work with radix 2M hugepage size -- 2.49.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id mM8GKPbl7Gh4bxoAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 11:43:50 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 11:43:50 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8Gxy-00000008gJy-17uh for hi@josie.lol; Mon, 13 Oct 2025 11:43:50 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 2F3584E49D4 for ; Mon, 13 Oct 2025 11:43:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3135D247299; Mon, 13 Oct 2025 11:43:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="jIEizXqu" X-Original-To: stable@vger.kernel.org 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 0B31D14A8B for ; Mon, 13 Oct 2025 11:43:45 +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=1760355826; cv=none; b=QhwQhoWLfkInH2xx2ZqifgtO4KGagzBp2lUyb8bNb3E8qXDmu+KVvq10bc1KIMI8M9KiVVS/FFGECzneL4w50pQv73qvqcud9v1KPzNIuvNNQBRPQbR4DeC1Gf4E902/fWh3XAe4j9ZEcchQiZXN9ZFZYdT6bzqfLONIj9U9Adw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760355826; c=relaxed/simple; bh=Pe+eHBmPLKAwv3CFCuKBWjPlRExlgkdXmVvdFUMNgpE=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=e3glTdEvY9u+d1tUFaD4CUZFHg0uL4SXvDrwm5BJ6ko3gInUX8++DrCRRr03l9dBNchOXUQZ5wh+wG96mX7achGayMz7i9fkXE85MvuOR1COrYs7a0sKxfGHRLTH6UxthuRXdbuAVc339yrAKoqawHr4zPZMORWBteKk8IfWEzw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=jIEizXqu; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24581C4CEE7; Mon, 13 Oct 2025 11:43:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760355825; bh=Pe+eHBmPLKAwv3CFCuKBWjPlRExlgkdXmVvdFUMNgpE=; h=Subject:To:Cc:From:Date:From; b=jIEizXquwo7W2aDn4arKY1qt/NHqXDDVs542tXDLMRQ/o6pGugO6dOOIzXZ0GxDVt 4fAXxaEZwGyQ1Qyqx6WYO/ypFdfM63M4sk3bkQ1LKrM1Rx22Vsq3KttuBAzgIbIPvM ROp8N7OkqjNg5RV1kRdJAF+D+DbPvgX+KCf0P32o= Subject: FAILED: patch "[PATCH] selftests/mm: skip soft-dirty tests when" failed to apply to 6.6-stable tree To: lance.yang@linux.dev,akpm@linux-foundation.org,david@redhat.com,krisman@collabora.com,lorenzo.stoakes@oracle.com,shuah@kernel.org,stable@vger.kernel.org Cc: From: Date: Mon, 13 Oct 2025 13:43:29 +0200 Message-ID: <2025101329-unplanted-language-2cc7@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit X-DKIM: signer='linuxfoundation.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: 4 The patch below does not apply to the 6.6-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y git checkout FETCH_HEAD git cherry-pick -x 0389c305ef56cbadca4cbef44affc0ec3213ed30 # git commit -s git send-email --to '' --in-reply-to '2025101329-unplanted-language-2cc7@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 0389c305ef56cbadca4cbef44affc0ec3213ed30 Mon Sep 17 00:00:00 2001 From: Lance Yang Date: Wed, 17 Sep 2025 21:31:37 +0800 Subject: [PATCH] selftests/mm: skip soft-dirty tests when CONFIG_MEM_SOFT_DIRTY is disabled The madv_populate and soft-dirty kselftests currently fail on systems where CONFIG_MEM_SOFT_DIRTY is disabled. Introduce a new helper softdirty_supported() into vm_util.c/h to ensure tests are properly skipped when the feature is not enabled. Link: https://lkml.kernel.org/r/20250917133137.62802-1-lance.yang@linux.dev Fixes: 9f3265db6ae8 ("selftests: vm: add test for Soft-Dirty PTE bit") Signed-off-by: Lance Yang Acked-by: David Hildenbrand Suggested-by: David Hildenbrand Cc: Lorenzo Stoakes Cc: Shuah Khan Cc: Gabriel Krisman Bertazi Cc: Signed-off-by: Andrew Morton diff --git a/tools/testing/selftests/mm/madv_populate.c b/tools/testing/selftests/mm/madv_populate.c index b6fabd5c27ed..d8d11bc67ddc 100644 --- a/tools/testing/selftests/mm/madv_populate.c +++ b/tools/testing/selftests/mm/madv_populate.c @@ -264,23 +264,6 @@ static void test_softdirty(void) munmap(addr, SIZE); } -static int system_has_softdirty(void) -{ - /* - * There is no way to check if the kernel supports soft-dirty, other - * than by writing to a page and seeing if the bit was set. But the - * tests are intended to check that the bit gets set when it should, so - * doing that check would turn a potentially legitimate fail into a - * skip. Fortunately, we know for sure that arm64 does not support - * soft-dirty. So for now, let's just use the arch as a corse guide. - */ -#if defined(__aarch64__) - return 0; -#else - return 1; -#endif -} - int main(int argc, char **argv) { int nr_tests = 16; @@ -288,7 +271,7 @@ int main(int argc, char **argv) pagesize = getpagesize(); - if (system_has_softdirty()) + if (softdirty_supported()) nr_tests += 5; ksft_print_header(); @@ -300,7 +283,7 @@ int main(int argc, char **argv) test_holes(); test_populate_read(); test_populate_write(); - if (system_has_softdirty()) + if (softdirty_supported()) test_softdirty(); err = ksft_get_fail_cnt(); diff --git a/tools/testing/selftests/mm/soft-dirty.c b/tools/testing/selftests/mm/soft-dirty.c index 8a3f2b4b2186..4ee4db3750c1 100644 --- a/tools/testing/selftests/mm/soft-dirty.c +++ b/tools/testing/selftests/mm/soft-dirty.c @@ -200,8 +200,11 @@ int main(int argc, char **argv) int pagesize; ksft_print_header(); - ksft_set_plan(15); + if (!softdirty_supported()) + ksft_exit_skip("soft-dirty is not support\n"); + + ksft_set_plan(15); pagemap_fd = open(PAGEMAP_FILE_PATH, O_RDONLY); if (pagemap_fd < 0) ksft_exit_fail_msg("Failed to open %s\n", PAGEMAP_FILE_PATH); diff --git a/tools/testing/selftests/mm/vm_util.c b/tools/testing/selftests/mm/vm_util.c index 56e9bd541edd..e33cda301dad 100644 --- a/tools/testing/selftests/mm/vm_util.c +++ b/tools/testing/selftests/mm/vm_util.c @@ -449,6 +449,23 @@ bool check_vmflag_pfnmap(void *addr) return check_vmflag(addr, "pf"); } +bool softdirty_supported(void) +{ + char *addr; + bool supported = false; + const size_t pagesize = getpagesize(); + + /* New mappings are expected to be marked with VM_SOFTDIRTY (sd). */ + addr = mmap(0, pagesize, PROT_READ | PROT_WRITE, + MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); + if (!addr) + ksft_exit_fail_msg("mmap failed\n"); + + supported = check_vmflag(addr, "sd"); + munmap(addr, pagesize); + return supported; +} + /* * Open an fd at /proc/$pid/maps and configure procmap_out ready for * PROCMAP_QUERY query. Returns 0 on success, or an error code otherwise. diff --git a/tools/testing/selftests/mm/vm_util.h b/tools/testing/selftests/mm/vm_util.h index 07c4acfd84b6..26c30fdc0241 100644 --- a/tools/testing/selftests/mm/vm_util.h +++ b/tools/testing/selftests/mm/vm_util.h @@ -104,6 +104,7 @@ bool find_vma_procmap(struct procmap_fd *procmap, void *address); int close_procmap(struct procmap_fd *procmap); int write_sysfs(const char *file_path, unsigned long val); int read_sysfs(const char *file_path, unsigned long *val); +bool softdirty_supported(void); static inline int open_self_procmap(struct procmap_fd *procmap_out) { From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id SLyRBQe+7WiPoQ8AYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 03:05:43 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 03:05:43 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8VM6-00000004pIn-259Q for hi@josie.lol; Tue, 14 Oct 2025 03:05:43 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E0EE23A3ECD for ; Tue, 14 Oct 2025 03:05:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 650F825D1E9; Tue, 14 Oct 2025 03:05:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iTxiJB2d" X-Original-To: stable@vger.kernel.org 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 3E8811E990E for ; Tue, 14 Oct 2025 03:05:31 +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=1760411134; cv=none; b=Ia9KgRLRt01Dpx8dFGWjAljLmvbb/wuNBsWXcGNMURsmI/5Kwk4sv1C8GbU2gT8HmC09DkF3X57P1ihouWg4zN4NpsFzm4KK1MwP1JSrbxulCGElasccISBzAjQQcogt6H0uaiZQWGsdD6Ev3jN/+XEE9z0LrTmG6ozdqI7fgic= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760411134; c=relaxed/simple; bh=cKckyvyq9sVnSIM4sO6Rp3o0SSLr8wszOr7SQy1tiYw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=W3vrtuq2CxZWRXNyz9Em8LwxEtdP5n7vmGLY0nMnb8/qnoa3QYl8jEMAqDzsCm3uCBGukV78zulENcH6rAZaTFIL8FrBhHuxCB2+BQNruIbQTMiVYGtsA6PTtfAhVoEDl+GH413ueRdr0UrhuNyrA0v/zwd7wvGYH4fLpsB/rKk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iTxiJB2d; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1518FC4CEE7; Tue, 14 Oct 2025 03:05:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760411131; bh=cKckyvyq9sVnSIM4sO6Rp3o0SSLr8wszOr7SQy1tiYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iTxiJB2dzsWu8d5S2h5nT5uooyLCCCgfeeWJHxo7Rx+C/QGuQE7suYkVOcYIC7x4J 1e/iO3wWi33TryndzDy2ePCvmQ35wnlbySDsfTzrm8+KzHX/tRQFxPnJwldVVl3D2p yxOgw2zD+gpeDeRQGBeS53tl8pRFmIbGmgYkNliK2odueYAhAbeVArlQ2LOQXnMUcF 5VzjXj4sBjgTHxuVlcqmxTbuSfNsSPiS65/s9ZWK1b5TM55N+nP6hg6GUkD1xyJpEj IH1hB8nN9VbJ56oBnzslyxqiRWiDeF/xAi+UxftxbaDVZWwjCHQb3RQ09JuB6StcYp PizcBWPyogXtQ== From: Sasha Levin To: stable@vger.kernel.org Cc: Yuan Chen , "Masami Hiramatsu (Google)" , Sasha Levin Subject: [PATCH 6.1.y] tracing: Fix race condition in kprobe initialization causing NULL pointer dereference Date: Mon, 13 Oct 2025 23:05:28 -0400 Message-ID: <20251014030528.3869596-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2025101322-quickstep-lanky-3be6@gregkh> References: <2025101322-quickstep-lanky-3be6@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -3.5 (---) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-3.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [139.178.88.99 listed in list.dnswl.org] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -34 From: Yuan Chen [ Upstream commit 9cf9aa7b0acfde7545c1a1d912576e9bab28dc6f ] There is a critical race condition in kprobe initialization that can lead to NULL pointer dereference and kernel crash. [1135630.084782] Unable to handle kernel paging request at virtual address 0000710a04630000 ... [1135630.260314] pstate: 404003c9 (nZcv DAIF +PAN -UAO) [1135630.269239] pc : kprobe_perf_func+0x30/0x260 [1135630.277643] lr : kprobe_dispatcher+0x44/0x60 [1135630.286041] sp : ffffaeff4977fa40 [1135630.293441] x29: ffffaeff4977fa40 x28: ffffaf015340e400 [1135630.302837] x27: 0000000000000000 x26: 0000000000000000 [1135630.312257] x25: ffffaf029ed108a8 x24: ffffaf015340e528 [1135630.321705] x23: ffffaeff4977fc50 x22: ffffaeff4977fc50 [1135630.331154] x21: 0000000000000000 x20: ffffaeff4977fc50 [1135630.340586] x19: ffffaf015340e400 x18: 0000000000000000 [1135630.349985] x17: 0000000000000000 x16: 0000000000000000 [1135630.359285] x15: 0000000000000000 x14: 0000000000000000 [1135630.368445] x13: 0000000000000000 x12: 0000000000000000 [1135630.377473] x11: 0000000000000000 x10: 0000000000000000 [1135630.386411] x9 : 0000000000000000 x8 : 0000000000000000 [1135630.395252] x7 : 0000000000000000 x6 : 0000000000000000 [1135630.403963] x5 : 0000000000000000 x4 : 0000000000000000 [1135630.412545] x3 : 0000710a04630000 x2 : 0000000000000006 [1135630.421021] x1 : ffffaeff4977fc50 x0 : 0000710a04630000 [1135630.429410] Call trace: [1135630.434828] kprobe_perf_func+0x30/0x260 [1135630.441661] kprobe_dispatcher+0x44/0x60 [1135630.448396] aggr_pre_handler+0x70/0xc8 [1135630.454959] kprobe_breakpoint_handler+0x140/0x1e0 [1135630.462435] brk_handler+0xbc/0xd8 [1135630.468437] do_debug_exception+0x84/0x138 [1135630.475074] el1_dbg+0x18/0x8c [1135630.480582] security_file_permission+0x0/0xd0 [1135630.487426] vfs_write+0x70/0x1c0 [1135630.493059] ksys_write+0x5c/0xc8 [1135630.498638] __arm64_sys_write+0x24/0x30 [1135630.504821] el0_svc_common+0x78/0x130 [1135630.510838] el0_svc_handler+0x38/0x78 [1135630.516834] el0_svc+0x8/0x1b0 kernel/trace/trace_kprobe.c: 1308 0xffff3df8995039ec : ldr x21, [x24,#120] include/linux/compiler.h: 294 0xffff3df8995039f0 : ldr x1, [x21,x0] kernel/trace/trace_kprobe.c 1308: head = this_cpu_ptr(call->perf_events); 1309: if (hlist_empty(head)) 1310: return 0; crash> struct trace_event_call -o struct trace_event_call { ... [120] struct hlist_head *perf_events; //(call->perf_event) ... } crash> struct trace_event_call ffffaf015340e528 struct trace_event_call { ... perf_events = 0xffff0ad5fa89f088, //this value is correct, but x21 = 0 ... } Race Condition Analysis: The race occurs between kprobe activation and perf_events initialization: CPU0 CPU1 ==== ==== perf_kprobe_init perf_trace_event_init tp_event->perf_events = list;(1) tp_event->class->reg (2)← KPROBE ACTIVE Debug exception triggers ... kprobe_dispatcher kprobe_perf_func (tk->tp.flags & TP_FLAG_PROFILE) head = this_cpu_ptr(call->perf_events)(3) (perf_events is still NULL) Problem: 1. CPU0 executes (1) assigning tp_event->perf_events = list 2. CPU0 executes (2) enabling kprobe functionality via class->reg() 3. CPU1 triggers and reaches kprobe_dispatcher 4. CPU1 checks TP_FLAG_PROFILE - condition passes (step 2 completed) 5. CPU1 calls kprobe_perf_func() and crashes at (3) because call->perf_events is still NULL CPU1 sees that kprobe functionality is enabled but does not see that perf_events has been assigned. Add pairing read and write memory barriers to guarantee that if CPU1 sees that kprobe functionality is enabled, it must also see that perf_events has been assigned. Link: https://lore.kernel.org/all/20251001022025.44626-1-chenyuan_fl@163.com/ Fixes: 50d780560785 ("tracing/kprobes: Add probe handler dispatcher to support perf and ftrace concurrent use") Cc: stable@vger.kernel.org Signed-off-by: Yuan Chen Signed-off-by: Masami Hiramatsu (Google) [ Drop fprobe changes + context ] Signed-off-by: Sasha Levin --- kernel/trace/trace_kprobe.c | 11 +++++++---- kernel/trace/trace_probe.h | 9 +++++++-- kernel/trace/trace_uprobe.c | 13 +++++++++---- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index cc155c4117684..a87e9eb7f37b9 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -1715,14 +1715,15 @@ static int kprobe_register(struct trace_event_call *event, static int kprobe_dispatcher(struct kprobe *kp, struct pt_regs *regs) { struct trace_kprobe *tk = container_of(kp, struct trace_kprobe, rp.kp); + unsigned int flags = trace_probe_load_flag(&tk->tp); int ret = 0; raw_cpu_inc(*tk->nhit); - if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) kprobe_trace_func(tk, regs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret = kprobe_perf_func(tk, regs); #endif return ret; @@ -1734,6 +1735,7 @@ kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) { struct kretprobe *rp = get_kretprobe(ri); struct trace_kprobe *tk; + unsigned int flags; /* * There is a small chance that get_kretprobe(ri) returns NULL when @@ -1746,10 +1748,11 @@ kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) tk = container_of(rp, struct trace_kprobe, rp); raw_cpu_inc(*tk->nhit); - if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tk->tp); + if (flags & TP_FLAG_TRACE) kretprobe_trace_func(tk, ri, regs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) kretprobe_perf_func(tk, ri, regs); #endif return 0; /* We don't tweak kernel, so just return 0 */ diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h index f48b3ed20b095..aab5066667ee4 100644 --- a/kernel/trace/trace_probe.h +++ b/kernel/trace/trace_probe.h @@ -257,16 +257,21 @@ struct event_file_link { struct list_head list; }; +static inline unsigned int trace_probe_load_flag(struct trace_probe *tp) +{ + return smp_load_acquire(&tp->event->flags); +} + static inline bool trace_probe_test_flag(struct trace_probe *tp, unsigned int flag) { - return !!(tp->event->flags & flag); + return !!(trace_probe_load_flag(tp) & flag); } static inline void trace_probe_set_flag(struct trace_probe *tp, unsigned int flag) { - tp->event->flags |= flag; + smp_store_release(&tp->event->flags, tp->event->flags | flag); } static inline void trace_probe_clear_flag(struct trace_probe *tp, diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index 53ef3cb65098d..a930ef372ef42 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c @@ -1497,6 +1497,7 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs) struct trace_uprobe *tu; struct uprobe_dispatch_data udd; struct uprobe_cpu_buffer *ucb; + unsigned int flags; int ret = 0; tu = container_of(con, struct trace_uprobe, consumer); @@ -1512,11 +1513,12 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs) ucb = prepare_uprobe_buffer(tu, regs); - if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tu->tp); + if (flags & TP_FLAG_TRACE) ret |= uprobe_trace_func(tu, regs, ucb); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret |= uprobe_perf_func(tu, regs, ucb); #endif uprobe_buffer_put(ucb); @@ -1529,6 +1531,7 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, struct trace_uprobe *tu; struct uprobe_dispatch_data udd; struct uprobe_cpu_buffer *ucb; + unsigned int flags; tu = container_of(con, struct trace_uprobe, consumer); @@ -1541,11 +1544,13 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, return 0; ucb = prepare_uprobe_buffer(tu, regs); - if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) + + flags = trace_probe_load_flag(&tu->tp); + if (flags & TP_FLAG_TRACE) uretprobe_trace_func(tu, func, regs, ucb); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) uretprobe_perf_func(tu, func, regs, ucb); #endif uprobe_buffer_put(ucb); -- 2.51.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id ODqvBrm37Ghy5gUAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 08:26:33 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 08:26:33 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8Dt2-000000022IW-086w for hi@josie.lol; Mon, 13 Oct 2025 08:26:32 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 64F2B188ECBF for ; Mon, 13 Oct 2025 08:26:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0DD242F3639; Mon, 13 Oct 2025 08:26:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="eYUPZDQG" X-Original-To: stable@vger.kernel.org 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 DE1772EFDAC for ; Mon, 13 Oct 2025 08:26:25 +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=1760343985; cv=none; b=LC2ezDzBdn3fuIVrvl1T4uBN8q4haAS4Pc4PYBa0dIf0XkQtHEH2ksVQpCX0YudZbFkEsaHW+VuYdTD/59z0XcvLBsnuadymoGo10VDm5g/k2In+j8m5hYW9u3X+6sGTSPv3LZtVdpWacJdMgcO8Qz8zLFMwQPBN3OzSM3DWsYE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760343985; c=relaxed/simple; bh=7k8R91fh2Syif+FovSvGeGSnMHUvM2TbgySo47knLKs=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=msAka8KzD4LRCd10lFEBebeYvPe2Cdf8oyMMnpZ9sPnHF2Iq6Zs1sgL6QvBW26/2z37Ow9Uidm1SpvCH/cKZE3+1ZZH+bxICv1PGMo51iohqfaNwvHf++ZCtCnVV6Mpkv0rqpjkXETHsQUcYwZWAMPZN61yY918/cY8HyPL8qGE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=eYUPZDQG; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15FE2C4CEFE; Mon, 13 Oct 2025 08:26:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760343985; bh=7k8R91fh2Syif+FovSvGeGSnMHUvM2TbgySo47knLKs=; h=Subject:To:Cc:From:Date:From; b=eYUPZDQGt4v8JhHARklNjyQ7EdIbbgYFIYIsZ/MjvTGwvdnuwIs8HUMO9cSZfWKYH DTNWMS1Wa9cQOQ74zVKWP+kbntseFsCmgdCUiKSrbKmTPwfLbJ5su7UENKSGaLdp2L Uk9GfNFOgTH55GendooT8QwWI9fXYn6czFBHHkAg= Subject: FAILED: patch "[PATCH] tracing: Fix race condition in kprobe initialization causing" failed to apply to 6.1-stable tree To: chenyuan@kylinos.cn,mhiramat@kernel.org Cc: From: Date: Mon, 13 Oct 2025 10:26:22 +0200 Message-ID: <2025101322-quickstep-lanky-3be6@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-DKIM: signer='linuxfoundation.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [147.75.80.249 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linuxfoundation.org] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -18 The patch below does not apply to the 6.1-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y git checkout FETCH_HEAD git cherry-pick -x 9cf9aa7b0acfde7545c1a1d912576e9bab28dc6f # git commit -s git send-email --to '' --in-reply-to '2025101322-quickstep-lanky-3be6@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 9cf9aa7b0acfde7545c1a1d912576e9bab28dc6f Mon Sep 17 00:00:00 2001 From: Yuan Chen Date: Wed, 1 Oct 2025 03:20:25 +0100 Subject: [PATCH] tracing: Fix race condition in kprobe initialization causing NULL pointer dereference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is a critical race condition in kprobe initialization that can lead to NULL pointer dereference and kernel crash. [1135630.084782] Unable to handle kernel paging request at virtual address 0000710a04630000 ... [1135630.260314] pstate: 404003c9 (nZcv DAIF +PAN -UAO) [1135630.269239] pc : kprobe_perf_func+0x30/0x260 [1135630.277643] lr : kprobe_dispatcher+0x44/0x60 [1135630.286041] sp : ffffaeff4977fa40 [1135630.293441] x29: ffffaeff4977fa40 x28: ffffaf015340e400 [1135630.302837] x27: 0000000000000000 x26: 0000000000000000 [1135630.312257] x25: ffffaf029ed108a8 x24: ffffaf015340e528 [1135630.321705] x23: ffffaeff4977fc50 x22: ffffaeff4977fc50 [1135630.331154] x21: 0000000000000000 x20: ffffaeff4977fc50 [1135630.340586] x19: ffffaf015340e400 x18: 0000000000000000 [1135630.349985] x17: 0000000000000000 x16: 0000000000000000 [1135630.359285] x15: 0000000000000000 x14: 0000000000000000 [1135630.368445] x13: 0000000000000000 x12: 0000000000000000 [1135630.377473] x11: 0000000000000000 x10: 0000000000000000 [1135630.386411] x9 : 0000000000000000 x8 : 0000000000000000 [1135630.395252] x7 : 0000000000000000 x6 : 0000000000000000 [1135630.403963] x5 : 0000000000000000 x4 : 0000000000000000 [1135630.412545] x3 : 0000710a04630000 x2 : 0000000000000006 [1135630.421021] x1 : ffffaeff4977fc50 x0 : 0000710a04630000 [1135630.429410] Call trace: [1135630.434828] kprobe_perf_func+0x30/0x260 [1135630.441661] kprobe_dispatcher+0x44/0x60 [1135630.448396] aggr_pre_handler+0x70/0xc8 [1135630.454959] kprobe_breakpoint_handler+0x140/0x1e0 [1135630.462435] brk_handler+0xbc/0xd8 [1135630.468437] do_debug_exception+0x84/0x138 [1135630.475074] el1_dbg+0x18/0x8c [1135630.480582] security_file_permission+0x0/0xd0 [1135630.487426] vfs_write+0x70/0x1c0 [1135630.493059] ksys_write+0x5c/0xc8 [1135630.498638] __arm64_sys_write+0x24/0x30 [1135630.504821] el0_svc_common+0x78/0x130 [1135630.510838] el0_svc_handler+0x38/0x78 [1135630.516834] el0_svc+0x8/0x1b0 kernel/trace/trace_kprobe.c: 1308 0xffff3df8995039ec : ldr x21, [x24,#120] include/linux/compiler.h: 294 0xffff3df8995039f0 : ldr x1, [x21,x0] kernel/trace/trace_kprobe.c 1308: head = this_cpu_ptr(call->perf_events); 1309: if (hlist_empty(head)) 1310: return 0; crash> struct trace_event_call -o struct trace_event_call { ... [120] struct hlist_head *perf_events; //(call->perf_event) ... } crash> struct trace_event_call ffffaf015340e528 struct trace_event_call { ... perf_events = 0xffff0ad5fa89f088, //this value is correct, but x21 = 0 ... } Race Condition Analysis: The race occurs between kprobe activation and perf_events initialization: CPU0 CPU1 ==== ==== perf_kprobe_init perf_trace_event_init tp_event->perf_events = list;(1) tp_event->class->reg (2)← KPROBE ACTIVE Debug exception triggers ... kprobe_dispatcher kprobe_perf_func (tk->tp.flags & TP_FLAG_PROFILE) head = this_cpu_ptr(call->perf_events)(3) (perf_events is still NULL) Problem: 1. CPU0 executes (1) assigning tp_event->perf_events = list 2. CPU0 executes (2) enabling kprobe functionality via class->reg() 3. CPU1 triggers and reaches kprobe_dispatcher 4. CPU1 checks TP_FLAG_PROFILE - condition passes (step 2 completed) 5. CPU1 calls kprobe_perf_func() and crashes at (3) because call->perf_events is still NULL CPU1 sees that kprobe functionality is enabled but does not see that perf_events has been assigned. Add pairing read and write memory barriers to guarantee that if CPU1 sees that kprobe functionality is enabled, it must also see that perf_events has been assigned. Link: https://lore.kernel.org/all/20251001022025.44626-1-chenyuan_fl@163.com/ Fixes: 50d780560785 ("tracing/kprobes: Add probe handler dispatcher to support perf and ftrace concurrent use") Cc: stable@vger.kernel.org Signed-off-by: Yuan Chen Signed-off-by: Masami Hiramatsu (Google) diff --git a/kernel/trace/trace_fprobe.c b/kernel/trace/trace_fprobe.c index b36ade43d4b3..ad9d6347b5fa 100644 --- a/kernel/trace/trace_fprobe.c +++ b/kernel/trace/trace_fprobe.c @@ -522,13 +522,14 @@ static int fentry_dispatcher(struct fprobe *fp, unsigned long entry_ip, void *entry_data) { struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp); + unsigned int flags = trace_probe_load_flag(&tf->tp); int ret = 0; - if (trace_probe_test_flag(&tf->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) fentry_trace_func(tf, entry_ip, fregs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tf->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret = fentry_perf_func(tf, entry_ip, fregs); #endif return ret; @@ -540,11 +541,12 @@ static void fexit_dispatcher(struct fprobe *fp, unsigned long entry_ip, void *entry_data) { struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp); + unsigned int flags = trace_probe_load_flag(&tf->tp); - if (trace_probe_test_flag(&tf->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) fexit_trace_func(tf, entry_ip, ret_ip, fregs, entry_data); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tf->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) fexit_perf_func(tf, entry_ip, ret_ip, fregs, entry_data); #endif } diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index fa60362a3f31..ee8171b19bee 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -1815,14 +1815,15 @@ static int kprobe_register(struct trace_event_call *event, static int kprobe_dispatcher(struct kprobe *kp, struct pt_regs *regs) { struct trace_kprobe *tk = container_of(kp, struct trace_kprobe, rp.kp); + unsigned int flags = trace_probe_load_flag(&tk->tp); int ret = 0; raw_cpu_inc(*tk->nhit); - if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) kprobe_trace_func(tk, regs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret = kprobe_perf_func(tk, regs); #endif return ret; @@ -1834,6 +1835,7 @@ kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) { struct kretprobe *rp = get_kretprobe(ri); struct trace_kprobe *tk; + unsigned int flags; /* * There is a small chance that get_kretprobe(ri) returns NULL when @@ -1846,10 +1848,11 @@ kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) tk = container_of(rp, struct trace_kprobe, rp); raw_cpu_inc(*tk->nhit); - if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tk->tp); + if (flags & TP_FLAG_TRACE) kretprobe_trace_func(tk, ri, regs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) kretprobe_perf_func(tk, ri, regs); #endif return 0; /* We don't tweak kernel, so just return 0 */ diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h index 842383fbc03b..08b5bda24da2 100644 --- a/kernel/trace/trace_probe.h +++ b/kernel/trace/trace_probe.h @@ -271,16 +271,21 @@ struct event_file_link { struct list_head list; }; +static inline unsigned int trace_probe_load_flag(struct trace_probe *tp) +{ + return smp_load_acquire(&tp->event->flags); +} + static inline bool trace_probe_test_flag(struct trace_probe *tp, unsigned int flag) { - return !!(tp->event->flags & flag); + return !!(trace_probe_load_flag(tp) & flag); } static inline void trace_probe_set_flag(struct trace_probe *tp, unsigned int flag) { - tp->event->flags |= flag; + smp_store_release(&tp->event->flags, tp->event->flags | flag); } static inline void trace_probe_clear_flag(struct trace_probe *tp, diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index 8b0bcc0d8f41..430d09c49462 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c @@ -1547,6 +1547,7 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs, struct trace_uprobe *tu; struct uprobe_dispatch_data udd; struct uprobe_cpu_buffer *ucb = NULL; + unsigned int flags; int ret = 0; tu = container_of(con, struct trace_uprobe, consumer); @@ -1561,11 +1562,12 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs, if (WARN_ON_ONCE(!uprobe_cpu_buffer)) return 0; - if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tu->tp); + if (flags & TP_FLAG_TRACE) ret |= uprobe_trace_func(tu, regs, &ucb); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret |= uprobe_perf_func(tu, regs, &ucb); #endif uprobe_buffer_put(ucb); @@ -1579,6 +1581,7 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, struct trace_uprobe *tu; struct uprobe_dispatch_data udd; struct uprobe_cpu_buffer *ucb = NULL; + unsigned int flags; tu = container_of(con, struct trace_uprobe, consumer); @@ -1590,11 +1593,12 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, if (WARN_ON_ONCE(!uprobe_cpu_buffer)) return 0; - if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tu->tp); + if (flags & TP_FLAG_TRACE) uretprobe_trace_func(tu, func, regs, &ucb); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) uretprobe_perf_func(tu, func, regs, &ucb); #endif uprobe_buffer_put(ucb); From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id CNUKE0HI7WgSIBMAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 03:49:21 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 03:49:21 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8W2K-00000006COw-3gvr for hi@josie.lol; Tue, 14 Oct 2025 03:49:21 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id CC82140670F for ; Tue, 14 Oct 2025 03:49:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0317018FDDE; Tue, 14 Oct 2025 03:49:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="SO7R+w7Q" X-Original-To: stable@vger.kernel.org Received: from out30-100.freemail.mail.aliyun.com (out30-100.freemail.mail.aliyun.com [115.124.30.100]) (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 912FB17A30A for ; Tue, 14 Oct 2025 03:49:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.100 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760413757; cv=none; b=GlyF0cb8xYJIHtzjmB6oShc8tacl1nTAUWVs52/pEhDr75KjaRfYzeCgziKvDU6yQTl4N5+c5GKKev3E03SuIH9RRm/wlzmsD2H3/qV0shZaKhFgXvdRsHihreHbe8+2tLabBEVzd9OVg9iIgpGPZ+gdztC3GJT/q/1U/rKaTbc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760413757; c=relaxed/simple; bh=YAcyXEgI+hXldoYFlpGXIvC109KWm3hpmHpiPV7nrs4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hiQq9mYI0ORxhtKxcnW/pwWwPNuRS2tTe3UQTzuQc1iA0H318HTrS9OZHqun7VNGVfM4XiNwl0sAzxNUzu/4JGPgWa0nKSldJJIg1QRcbUX2obzO8AM89WnJ5kKC6eVqfCR5ZuSAkaeGdGsB4eBa/+znHj0jLawkgu3UZZZhZFo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=SO7R+w7Q; arc=none smtp.client-ip=115.124.30.100 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1760413746; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=WVB1k0iyALQBn8mrDij0TlFOM8IGUTNYDz3MNRZQY6A=; b=SO7R+w7Q1VT2676pryDMpMswxjN4ChJbOtfzynMvczpZsnjU6G9CFQTa9uvDCCjIw9NgbdyTNcLSYz5Tpk2vAevMJ/khRaarkiPUAEFz+DbaWYcbPh5Ffdf6EW4nB1fDM/YdEV3vhsYd7F17T4WYUsc7+AAvguNcMNbYJmNZzy8= Received: from 30.74.144.134(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0WqAD6FT_1760413744 cluster:ay36) by smtp.aliyun-inc.com; Tue, 14 Oct 2025 11:49:04 +0800 Message-ID: <51b210a5-3967-45d1-a081-465b2c5f0fd1@linux.alibaba.com> Date: Tue, 14 Oct 2025 11:49:04 +0800 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [Patch v2] mm/huge_memory: add pmd folio to ds_queue in do_huge_zero_wp_pmd() To: Wei Yang , akpm@linux-foundation.org, david@redhat.com, lorenzo.stoakes@oracle.com, ziy@nvidia.com, Liam.Howlett@oracle.com, npache@redhat.com, ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org, lance.yang@linux.dev, wangkefeng.wang@huawei.com Cc: linux-mm@kvack.org, stable@vger.kernel.org References: <20251002013825.20448-1-richard.weiyang@gmail.com> From: Baolin Wang In-Reply-To: <20251002013825.20448-1-richard.weiyang@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-DKIM: signer='linux.alibaba.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -7.1 (-------) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-7.1 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM welcome-list 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: -70 On 2025/10/2 09:38, Wei Yang wrote: > We add pmd folio into ds_queue on the first page fault in > __do_huge_pmd_anonymous_page(), so that we can split it in case of > memory pressure. This should be the same for a pmd folio during wp > page fault. > > Commit 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") miss > to add it to ds_queue, which means system may not reclaim enough memory > in case of memory pressure even the pmd folio is under used. > > Move deferred_split_folio() into map_anon_folio_pmd() to make the pmd > folio installation consistent. > > Fixes: 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") > Signed-off-by: Wei Yang > Cc: David Hildenbrand > Cc: Lance Yang > Cc: Dev Jain > Cc: > > --- Nice catch. LGTM. Reviewed-by: Baolin Wang From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id +KUGBpCI4GipkiwAYBR5ng (envelope-from ) for ; Sat, 04 Oct 2025 02:38:08 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Sat, 04 Oct 2025 02:38:08 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v4s9v-0000000CSL1-3I2N for hi@josie.lol; Sat, 04 Oct 2025 02:38:08 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id DE5A24F03F0 for ; Sat, 4 Oct 2025 02:38:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E3E89215F6B; Sat, 4 Oct 2025 02:37:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="IO2KSUrz" X-Original-To: stable@vger.kernel.org Received: from out-188.mta1.migadu.com (out-188.mta1.migadu.com [95.215.58.188]) (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 39AA6154BF5 for ; Sat, 4 Oct 2025 02:37:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759545471; cv=none; b=riDvrD3iYCfJ/Rw89ljQ7PUgc7G/Pi2IDq0LmUY4GzOD9y/HyKu5x2RIJw+1OHXTF0B3w3yB8mlD7k514IRITpMFeHdry+QFwegcIlSwLmoZ7XMBOEJkE+dSmHep1JQ4kIF0OHyJal5P8WsszNU5f9KNucTC0kI+pSJJTeMMRPI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759545471; c=relaxed/simple; bh=ojEC4F74RyQdjtfSesHvInRes6Dm0twjpKoZy9BdHO0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Uy10pFpEtRpejuml33MDg/qsbWFUygOPsgkbcZtAaR/XUKm3a5kBYMl5+6gq9WX/Dt/ITN9GFDYiWtgBrsCVSxhni8K+E4Vb77zf8PlCt8SGr/JTv3v+UWtrEh7IOwYMCVhHnXO6wYHHwLVXaIH30g+jC8x5nzlC8KVMF7Ef/30= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=IO2KSUrz; arc=none smtp.client-ip=95.215.58.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: <6c4be2e8-04f5-49c6-9055-cef033716c19@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1759545467; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZtsI3lx2659ed28Hsfe3yffVn1tmzg1sTkqeGJ64sdY=; b=IO2KSUrzq3V4cuTh3UvbNkBrJC37Pe4HdjZa1lIkRq+QI5SWpv8888ULk3oRQ/d9QYS8Qm 0dZg+eRRrT2guK4KsRhzfCQtFhiTwyE1bDA9xwVDVDKaG1ZxVGh47HBeZecDDyD59xJk14 O2bQfUuPDvgjzk1F/Oo+VzJwxOfh0+Q= Date: Sat, 4 Oct 2025 10:37:32 +0800 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [Patch v2] mm/huge_memory: add pmd folio to ds_queue in do_huge_zero_wp_pmd() Content-Language: en-US To: Wei Yang Cc: linux-mm@kvack.org, baolin.wang@linux.alibaba.com, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, wangkefeng.wang@huawei.com, stable@vger.kernel.org, ziy@nvidia.com, ryan.roberts@arm.com, dev.jain@arm.com, npache@redhat.com, baohua@kernel.org, akpm@linux-foundation.org, david@redhat.com References: <20251002013825.20448-1-richard.weiyang@gmail.com> <20251004020447.slfiuvu5elidwosl@master> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Lance Yang In-Reply-To: <20251004020447.slfiuvu5elidwosl@master> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-DKIM: signer='linux.dev' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linux.dev] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in bl.score.senderscore.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On 2025/10/4 10:04, Wei Yang wrote: > On Fri, Oct 03, 2025 at 09:49:28PM +0800, Lance Yang wrote: >> Hey Wei, >> >> On 2025/10/2 09:38, Wei Yang wrote: >>> We add pmd folio into ds_queue on the first page fault in >>> __do_huge_pmd_anonymous_page(), so that we can split it in case of >>> memory pressure. This should be the same for a pmd folio during wp >>> page fault. >>> >>> Commit 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") miss >>> to add it to ds_queue, which means system may not reclaim enough memory >> >> IIRC, it was commit dafff3f4c850 ("mm: split underused THPs") that >> started unconditionally adding all new anon THPs to _deferred_list :) >> > > Thanks for taking a look. > > While at this time do_huge_zero_wp_pmd() is not introduced, how it fix a Ah, I see. I was focused on the policy change ... > non-exist case? And how could it be backported? I am confused here. And, yes, 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") was merged later and it introduced the new do_huge_zero_wp_pmd() path without aligning with the policy ... Thanks for clarifying! Lance > >>> in case of memory pressure even the pmd folio is under used. >>> >>> Move deferred_split_folio() into map_anon_folio_pmd() to make the pmd >>> folio installation consistent. >>> >>> Fixes: 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") >> >> Shouldn't this rather be the following? >> >> Fixes: dafff3f4c850 ("mm: split underused THPs") >> >> Thanks, >> Lance > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id WMfiG86C4GjsDioAYBR5ng (envelope-from ) for ; Sat, 04 Oct 2025 02:13:34 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Sat, 04 Oct 2025 02:13:34 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v4rmA-0000000BkLR-0nzd for hi@josie.lol; Sat, 04 Oct 2025 02:13:34 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id A98F64E4C6E for ; Sat, 4 Oct 2025 02:13:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 967A822DFB5; Sat, 4 Oct 2025 02:13:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="c7cdn82/" X-Original-To: stable@vger.kernel.org Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6D131DF256 for ; Sat, 4 Oct 2025 02:13:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759544008; cv=none; b=uSVhuk/j3BlQ0vS4KkA1N5OPXckZlehVi5T04Wni1pnao4tQAHgIY5gvd3j12uHR87m0mv/zxjqlKjzejRBCY139AKbYLrrF+WLtm4hePFmquOye1/2wZqLsqIEivr8NSkaNtqQQ4qFOu++np014wLtBIItallaZtrOBAKZLOkA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759544008; c=relaxed/simple; bh=IC1wAmF1V4kC4QdEDu0MSID9io6Ti43c6Cb+uzw0By4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nRzlMFjBME7VAqfhnmFFhm+f/w2sIRhRpLfDBsxNdxCyr2NnSePLu3/AkU6Gf14AbkgtRaxD8FSketwYT+BcuCnZHBIQ9lyVDvLTtUOn6B5bIk8rAjOfyYAXYj+Z7YfUkNqUNz0EK7XzQRDNVaTDIKtDE/g2GwC/zDeiXf6uf2A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=c7cdn82/; arc=none smtp.client-ip=209.85.218.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-b4736e043f9so519260966b.0 for ; Fri, 03 Oct 2025 19:13:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759544005; x=1760148805; darn=vger.kernel.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=EJLGML/fAE3TNb3uOnRyVtfPhEJ/kKcyWW/gv7o0MK0=; b=c7cdn82/CkmKbB1ArwgNSANWO/EJQRsZOS9KLNCWPcWFg5LrzBShtbCs9grqJHXvBf zHYB944Q7KOjieY/FwwI62uNeo6c5XfIIhaLRuEr8Zj0kURcYBbkO4ejTb3IsEVbmYlP 0Z+Q+tUOyXxwFqti9mQakZOUyJR2JRYw+8FcMieO88azGZf7R3RMwHXNaqqVB1tOhbG/ zq2VIK47gLCy0srrao9vFcyOumvqj1z2HD8SZ0m8QxX/drWUZQWughwGrBwGG6sws80t O4WfaH8G5nVf8vHN9Z4qZSIIsasMsHDNDuLwwD1B6lid2cjjElw3bL6HCftkc7LEwK9S YS8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759544005; x=1760148805; h=user-agent:in-reply-to:content-disposition:mime-version:references :reply-to:message-id:subject:cc:to:from:date:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=EJLGML/fAE3TNb3uOnRyVtfPhEJ/kKcyWW/gv7o0MK0=; b=kNKvohwWh09YH1NyTXFzDzzZjXAKmmM/P6GMrLWyxPkpTiu7nVLI2BrOXk8IOw3+Ye ryn2dmtWf3C3AEnVsFaZHp3Q11e4ZBbIapjirohp8BopYhIN72YWaarOis9ZkZHPn+sn vgRd40Cc+JVLRHYaKdDBwurCylYRwBJD6FfWTw1FKo9fnfOYyEkDgYhs+JfEK3SwtTgX WeucJHfQnR44t4oRnPcEwr1ITslnRqNFLPPekGxJpNV6xAXlZsDaml9EwijsBcQYrB2t e/LozptbA+kitxzzGBwiTVbjf+5ziWsN7nz4fym/szRjW0pJ/S9x0ULaY0B8a7E1hh6g hKBA== X-Forwarded-Encrypted: i=1; AJvYcCXHhmwqWYRnXdRzt7GpUTU6EzvvNW4vpDQgfitIsaUxq+bDX91bIbsVobpWz1o/WR8EGhor0nA=@vger.kernel.org X-Gm-Message-State: AOJu0Yz5eDvE8Et3qHN7EUU2xH6DN6NpVf52JW+zLaA8Ghx+Sb9hh5sa pq8nS1wznrDrTWbVVpT3oLIiVm+N0guzBS8MBAoUCFfIXKVPOa+OgL1I X-Gm-Gg: ASbGncucsFhTeVv8WDyioI15sVWFSt46ZBF97j0vTYq4WAAWZczYOXpjn3KgAZiLFdu LI1ouGjkLoJC0AHMVde+4IMUvjbHm3nwfBSJ1B0oXmhUUH9BPxcRC4zXkHKeYoWqNRiTafB7qX3 WVMp1w6U1u29WGuqrYOR8leb8Zjj3PDDeeA1lLE2mfVp2TajzpFeaoROTkEeGH7U/po+Ajh+dNs I8eSG9GVQp7l790OsIMfZOVVBo59yteeX9XtgP07ShgXEL3KR96N+B7AqsfYowM1AX4jJ17jUIa gNtxW8J4VEpeLTNeJTDgpW88IPbO7X1Or7l0B4iCIQIlZBJl0UDAv09mdGDvhbVHAI5pOjtWz57 HpbmHkXVoJv6r4XGCP0/xD+n6Eq2Ndv6f8Q6JZNN5n6M3fRyWLms7QomZ X-Google-Smtp-Source: AGHT+IH6Q3EMy72+qe0t0hsQggbLgNWiTJAlAWog89Yxth2YTCEdR/jsq63Jce8LF6RMeQgMSpj70A== X-Received: by 2002:a17:907:3f9f:b0:b3e:fe8f:764 with SMTP id a640c23a62f3a-b49c47abb5dmr658409766b.32.1759544004993; Fri, 03 Oct 2025 19:13:24 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b4865e77427sm569595766b.36.2025.10.03.19.13.24 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Oct 2025 19:13:24 -0700 (PDT) Date: Sat, 4 Oct 2025 02:13:24 +0000 From: Wei Yang To: Zi Yan Cc: Usama Arif , Lance Yang , Wei Yang , linux-mm@kvack.org, baolin.wang@linux.alibaba.com, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, wangkefeng.wang@huawei.com, stable@vger.kernel.org, ryan.roberts@arm.com, dev.jain@arm.com, npache@redhat.com, baohua@kernel.org, akpm@linux-foundation.org, david@redhat.com Subject: Re: [Patch v2] mm/huge_memory: add pmd folio to ds_queue in do_huge_zero_wp_pmd() Message-ID: <20251004021324.t2mysqcblqvwa4bv@master> Reply-To: Wei Yang References: <20251002013825.20448-1-richard.weiyang@gmail.com> <1286D3DE-8F53-4B64-840F-A598B130DF13@nvidia.com> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1286D3DE-8F53-4B64-840F-A598B130DF13@nvidia.com> User-Agent: NeoMutt/20170113 (1.7.2) X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [richard.weiyang[at]gmail.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On Fri, Oct 03, 2025 at 10:08:37AM -0400, Zi Yan wrote: >On 3 Oct 2025, at 9:49, Lance Yang wrote: > >> Hey Wei, >> >> On 2025/10/2 09:38, Wei Yang wrote: >>> We add pmd folio into ds_queue on the first page fault in >>> __do_huge_pmd_anonymous_page(), so that we can split it in case of >>> memory pressure. This should be the same for a pmd folio during wp >>> page fault. >>> >>> Commit 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") miss >>> to add it to ds_queue, which means system may not reclaim enough memory >> >> IIRC, it was commit dafff3f4c850 ("mm: split underused THPs") that >> started unconditionally adding all new anon THPs to _deferred_list :) >> >>> in case of memory pressure even the pmd folio is under used. >>> >>> Move deferred_split_folio() into map_anon_folio_pmd() to make the pmd >>> folio installation consistent. >>> >>> Fixes: 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") >> >> Shouldn't this rather be the following? >> >> Fixes: dafff3f4c850 ("mm: split underused THPs") > >Yes, I agree. In this case, this patch looks more like an optimization >for split underused THPs. > >One observation on this change is that right after zero pmd wp, the >deferred split queue could be scanned, the newly added pmd folio will >split since it is all zero except one subpage. This means we probably >should allocate a base folio for zero pmd wp and map the rest to zero >page at the beginning if split underused THP is enabled to avoid >this long trip. The downside is that user app cannot get a pmd folio >if it is intended to write data into the entire folio. Thanks for raising this. IMHO, we could face the similar situation in __do_huge_pmd_anonymous_page(). If my understanding is correct, the allocated folio is zeroed and we don't have idea how user would write data to it. Since shrinker is active when memory is low, maybe vma_alloc_anon_folio_pmd() has told use current status of the memory. If it does get a pmd folio, we are probably having enough memory in the system. > >Usama might be able to give some insight here. > -- Wei Yang Help you, Help me From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id mM7VCcqA4GhcHykAYBR5ng (envelope-from ) for ; Sat, 04 Oct 2025 02:04:58 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Sat, 04 Oct 2025 02:04:58 +0000 Received: from ams.mirrors.kernel.org ([213.196.21.55]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v4rdp-0000000BTUO-3T4u for hi@josie.lol; Sat, 04 Oct 2025 02:04:58 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.mirrors.kernel.org (Postfix) with ESMTPS id 8DA90347BB1 for ; Sat, 4 Oct 2025 02:04:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0F49927B35D; Sat, 4 Oct 2025 02:04:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XE40yy8P" X-Original-To: stable@vger.kernel.org Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4FA6627B4E5 for ; Sat, 4 Oct 2025 02:04:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759543492; cv=none; b=NsekbyL5A0yfSCBPy8amUEUlyChv2BBqACWCL2T6ckZL0w3DACScGMrGLbOB9+6fCs9rhZc8psMmQ46Gsck2GvIbXL5bTO6EU5FI7ohvPPOkUqtByinkgJbKLL/edYboXPgVKsHEvOnBnV4KnkPzNykRbgaHPY2Uj/Wj0AEXU/U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759543492; c=relaxed/simple; bh=WDDZsOZwZa9YUhMOjILbEPO6mHVX9FMY8wOwG2a8evQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gB99wWc4I7v2HUXE/jJoGwXJmpcWD4mCYZJEBnfGVKZ+pVyHf7IwPW0dUFd6yMLSjYTUKINa8ATHXaeupD61FGU35kweGpxoI4HyXo+W9ku4zJqO8//4Xsc9BcVj+fi5m4JvfKrJOaSN/Dy4/2BUeRY3792ZrXlmYCd3ARS8HzM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XE40yy8P; arc=none smtp.client-ip=209.85.218.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-b3d196b7eeeso448625366b.0 for ; Fri, 03 Oct 2025 19:04:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759543488; x=1760148288; darn=vger.kernel.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=1D7C9zfNsAR/zhcIDvXmSkVC80C03VQ0i27Aj45Yc+c=; b=XE40yy8PF9VpxAhC+Njvrgc94a+aXuuYRalXvB4CVfH3dKKSDLVhQwcrbuEIDEDzkn WNEIYEiVTjQ40ZVkDl/o0gt+5FPjA8TkWWL1fKpVLvD103M6UF+HXsE+mbSzXVCbrQNW ZggJ4Qq40ZErufmu9HltwSja/UDnrgty+MMSj3KUK8AQhbbH90LBMzlmTl6nE2ZxtUJ2 Z/C6LWKAlzkbnIuO3/fUv4qmLFtTjCi+8xpfg8OzH98RA2zNvKuZxPw9yZhUMlKsY25f elFyy8u2pFd+c7tcyV6B/sjwOpPyQLhSBu2hXdMlSKFk+K1ucXJRPscidIIMsPh0ENAZ yv5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759543488; x=1760148288; h=user-agent:in-reply-to:content-disposition:mime-version:references :reply-to:message-id:subject:cc:to:from:date:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=1D7C9zfNsAR/zhcIDvXmSkVC80C03VQ0i27Aj45Yc+c=; b=YkHUP8ay0TiIAhA4lO2zD30Fl5ZTHbnxX95ZSu+5S087JleLMcbkY0yTqKZURNPuvz 7Z510Y1uaBQqu8cTyZ7fE+pjOR5VVDyeOeGN6J4djktU3Tq2UE3vS7oKbH2CxG5wFKed uhGpMBAQI/4LyLR004I8wWgHaJAqOEG2sWIuqLGOA1EW5kL9ASs0n7M6E2CCWZSCuOQ1 0HGk4F6y4DTwuzqE0q41qSWP/mEeDR3jNWv2hEt2OVxX66knD58CFbQlTVpi97M+pW9u lUdgPqQNsDwU3gvCCONG/NqdoqUDcL3xRyMYkGs6kXCZUgZe7O2ne5nWJiF8tytDTSyQ Ji0g== X-Forwarded-Encrypted: i=1; AJvYcCWnrohu4Ww2dMWJa9mK1deUbip1Bcto1Z3R1nG5FCGrAAyQfd8OYtJywqTsTdXkgUeapUQR8KQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwN1cYnzD8jG0Cs1YRv+ugLM/IakbPTx9DfHVES4SVLUkhf93Tm xKA/b8/1V6nUVrMq8e3Kr+GUKse49RvzjMj7uO/VDDET8TNQNj2nOU9t X-Gm-Gg: ASbGncslOppdVwQoSeyxR8FuTPmUokf+JDsbtWbam1SL3YfFbJxrdlWIIBKhV4Img0G BigPBu9x6u0Md2e22j1ukw+X8AbVYV4UFDuKexkc1L7TyPJfQ4GYbgnFsCOPVt4C5Oo5J6b0QnJ 1jok2CDdABR3mOpWlQ/V1rHDxD6N52UAQqmiH5mZ6vnfThCATIwCsJqwio25IWdQ9+NlwZh9dai kdOqb3+JsqfyRI+kQf/N/p2rVxR1TJXH2AthCWKIlvQFdw1qExiAmAxHKLoDwvNmfXRMWXSWHyP GNFy5MrRDLCCDm2uHf0Amf2WmGsfftlB/weAcADvredr5VJD3kerQVjdz9kqlZE/x/dHSn9DLaW NVTqp9oIvSJ4kTlWeEhuGXVNYmh2rEtULvAGgSIu9yJsi5A== X-Google-Smtp-Source: AGHT+IGdf6+OJ2c9+tXrX4oHWR5q+E8r/dTC8pl8N733c73y1ngTRj5iM5bJ0CancYL7rUU+jL2oLg== X-Received: by 2002:a17:907:3f8f:b0:b3c:4ebc:85e6 with SMTP id a640c23a62f3a-b49c146e65dmr579667266b.10.1759543488268; Fri, 03 Oct 2025 19:04:48 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b486970b32bsm588129566b.50.2025.10.03.19.04.47 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Oct 2025 19:04:47 -0700 (PDT) Date: Sat, 4 Oct 2025 02:04:47 +0000 From: Wei Yang To: Lance Yang Cc: Wei Yang , linux-mm@kvack.org, baolin.wang@linux.alibaba.com, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, wangkefeng.wang@huawei.com, stable@vger.kernel.org, ziy@nvidia.com, ryan.roberts@arm.com, dev.jain@arm.com, npache@redhat.com, baohua@kernel.org, akpm@linux-foundation.org, david@redhat.com Subject: Re: [Patch v2] mm/huge_memory: add pmd folio to ds_queue in do_huge_zero_wp_pmd() Message-ID: <20251004020447.slfiuvu5elidwosl@master> Reply-To: Wei Yang References: <20251002013825.20448-1-richard.weiyang@gmail.com> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [213.196.21.55 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [213.196.21.55 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [213.196.21.55 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [richard.weiyang[at]gmail.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On Fri, Oct 03, 2025 at 09:49:28PM +0800, Lance Yang wrote: >Hey Wei, > >On 2025/10/2 09:38, Wei Yang wrote: >> We add pmd folio into ds_queue on the first page fault in >> __do_huge_pmd_anonymous_page(), so that we can split it in case of >> memory pressure. This should be the same for a pmd folio during wp >> page fault. >> >> Commit 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") miss >> to add it to ds_queue, which means system may not reclaim enough memory > >IIRC, it was commit dafff3f4c850 ("mm: split underused THPs") that >started unconditionally adding all new anon THPs to _deferred_list :) > Thanks for taking a look. While at this time do_huge_zero_wp_pmd() is not introduced, how it fix a non-exist case? And how could it be backported? I am confused here. >> in case of memory pressure even the pmd folio is under used. >> >> Move deferred_split_folio() into map_anon_folio_pmd() to make the pmd >> folio installation consistent. >> >> Fixes: 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") > >Shouldn't this rather be the following? > >Fixes: dafff3f4c850 ("mm: split underused THPs") > >Thanks, >Lance -- Wei Yang Help you, Help me From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id iMWwOO4D4Gi6+SgAYBR5ng (envelope-from ) for ; Fri, 03 Oct 2025 17:12:14 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Fri, 03 Oct 2025 17:12:14 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v4jKI-0000000Bsai-2AzI for hi@josie.lol; Fri, 03 Oct 2025 17:12:14 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 451AE1B211CA for ; Fri, 3 Oct 2025 17:12:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A3032D839B; Fri, 3 Oct 2025 17:12:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="bT2Lwqm9" X-Original-To: stable@vger.kernel.org Received: from CH4PR04CU002.outbound.protection.outlook.com (mail-northcentralusazon11013016.outbound.protection.outlook.com [40.107.201.16]) (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 67910260590 for ; Fri, 3 Oct 2025 17:12:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.201.16 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759511530; cv=fail; b=CMZGiG5ib7a2/cHJ3OD9i0dXQLCLzYyDi47nEk1bikRyabEbCPYOxM08Yzafy31y7LJaxo1QcHIxsxxGHv9xrXDGoSbyYKv5f0V2VTo4k2J4MFQ5vmd3q6w5fpWpxxTZ4UDJ/oxv62ZTgczLNqkDABEd2QCT2xM5ECBzyUKt5Ic= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759511530; c=relaxed/simple; bh=qFWcvf87Zl0eO0b/u6izBvTv85uTNBDQ8JSu2z+MJb4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=WVLUsU5Os93SOWOjppYv82NWgDv1v+46vBBmQFKDChAZw8ZyuZbTZ4sTr8e9OF9iUWjVUdNUV1HiGDnguKEy8CV+aLoojdtcW3ppGod7aa8CqN16KbPigeRHwOZr1mKtVixAcEdB9G279m7vlsCUoLgl9MaOOXMaucT77QWcg5A= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=bT2Lwqm9; arc=fail smtp.client-ip=40.107.201.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vkbSeV0rt+L7f2F3vh875LPtLmelK3pGeBp2k8x5aNKF2zC0s9pyPCY5vkbTQzX0J9E8YMgZtiURnizz79QraM7vWWwE8n65+xfODCyMctZr4PH4Zd//pkX6roGV9+nxKTtKp844XzXS/MCll5p6DG1/ycteK0p2RIjqv3HguA1OmOMMHqReMdb3RfyHflSfjRCPSTRuAfJ8XrIWQbBFsXdSrl5e92zPcfj5VV94uv7chTlsMTxHqPMievzJF28Uk7hgMSuvNvG4NdajRy78PSR3Awv4PuOOzJc4yO3nkv1TC6DfoiL/7oe4j93sZkg0a2NonOHXiK5snT9xmLfD9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Im+8lRf5N/pjTNVBcX8kmjP5KpMj9WjG4I7Jv4zYoKU=; b=T3Ae81BBOg6mqfwq5QFn/NJah8yI75/nWiiOa29e7vKXxfYkCTJxIN5aZ07Zh+aKOaFBxzNXJnD79IRTVR5b+D6kS/a1bheNnrlfkRo45yChQm3MzdhyxPXw6d67pa+faTNdYiY2By3gbrwOqHKVQmzXhZM2Mi0cwEdqwP+C2QSruUV3lGNbPsJsJ+Wcgwwh6NCahivf2wCn+x/zbuD/l2mhDgjbWUu6xj/6p8c2Y5JYJcx0ZeN0IZzn7Qf/v+p3EMjhWxXjb4zZZSJYg/CO+VV4LE7azsY5PtlmzuBIrcOfDz64ixsOjy0LyKJPO9g7NE4wMUffScIxlcI3rSNJXw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Im+8lRf5N/pjTNVBcX8kmjP5KpMj9WjG4I7Jv4zYoKU=; b=bT2Lwqm9Ys59h84E04p4mv5xohEPPy703p0M5sHxFXG0PJPeSRW6loc8XkE/OnaLr6lb1yUT82oejPWdzNtxVd94kOEoXTjLP7THfv7IqMqktbwEY8k60iR8WYGdgrxmRmk5gvQmZGKjZiv6yKZTybIEgL8RTc1D9nuWewpZQtwweieSt4RGvgoWs3Jywcjp7dRakTPzIDd7uZv9n1fe8tdYxVWab/RVU++TpXzIUFZyqQk7qKoHrHMzBfH61kZoK0caKpyRGlScT8UiqGPgD3vUei8u/A87K3n0AaJRXhAOuUXMgiQA50OdCdC9gIXkNNgJYZX2Vx4gn8jxdoSdPQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) by IA1PR12MB8517.namprd12.prod.outlook.com (2603:10b6:208:449::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9160.18; Fri, 3 Oct 2025 17:12:01 +0000 Received: from DS7PR12MB9473.namprd12.prod.outlook.com ([fe80::5189:ecec:d84a:133a]) by DS7PR12MB9473.namprd12.prod.outlook.com ([fe80::5189:ecec:d84a:133a%5]) with mapi id 15.20.9160.017; Fri, 3 Oct 2025 17:12:01 +0000 From: Zi Yan To: Usama Arif Cc: Lance Yang , Wei Yang , linux-mm@kvack.org, baolin.wang@linux.alibaba.com, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, wangkefeng.wang@huawei.com, stable@vger.kernel.org, ryan.roberts@arm.com, dev.jain@arm.com, npache@redhat.com, baohua@kernel.org, akpm@linux-foundation.org, david@redhat.com Subject: Re: [Patch v2] mm/huge_memory: add pmd folio to ds_queue in do_huge_zero_wp_pmd() Date: Fri, 03 Oct 2025 13:11:58 -0400 X-Mailer: MailMate (2.0r6283) Message-ID: <5C87F8F6-C508-4BE4-A3B4-9563AF48EFE6@nvidia.com> In-Reply-To: <29ac3e02-fb60-47ed-9834-033604744624@gmail.com> References: <20251002013825.20448-1-richard.weiyang@gmail.com> <1286D3DE-8F53-4B64-840F-A598B130DF13@nvidia.com> <29ac3e02-fb60-47ed-9834-033604744624@gmail.com> Content-Type: text/plain Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BN9P221CA0003.NAMP221.PROD.OUTLOOK.COM (2603:10b6:408:10a::25) To DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR12MB9473:EE_|IA1PR12MB8517:EE_ X-MS-Office365-Filtering-Correlation-Id: c12422c3-9b6c-4ff2-eff9-08de029ff79c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?E4rl2Woe8L9aX0LaLC1y0aZtcv3bxRNvXz3xRwVTyAbbqUUo6qs7w7iZ/CD7?= =?us-ascii?Q?lAFqUqa4f9tXm1rRvSVwD1VhO2NRkIDEc2kkSpNnzfBwX2upRBGxGpZvsb7Z?= =?us-ascii?Q?0thAjrRwTt2oaS7fZ059MHPpTIPmxpG+dDw0WNI00aKJCjsKJQJPFSw0kVzF?= =?us-ascii?Q?vSlBcG7ZCcEsKGlE1h4V29SoXmZ3/f8Jq3JLueqLWfDm0WW7+7m2JFwgRFpZ?= =?us-ascii?Q?RlqktO/RLmmydeSYgBB71ks7MkSo8HMtBi8bgt3NweKnf/n6r9Gj4I9qHrLY?= =?us-ascii?Q?/SP8iV8g3nwt45hGgvgxZh7KuATaQRmflfDREOAbkXB/nAiui+tXow4pAYT+?= =?us-ascii?Q?gzmMJTwCvckTpxVOiPIVNHs036nh5Jt+pRjAFknwxMzCS3s4hqECDkdpV87O?= =?us-ascii?Q?i3nng3JlZ6xEHZGni6c6ZHiDe/Qq6BGhNccW95w6yoqpOYwl6v/9xV+Gn8fS?= =?us-ascii?Q?qvrfYFHX/TO4KpuoxoDSbaYTpmE487K6yypAon5StVr02vaj0Zk3adIhYPn9?= =?us-ascii?Q?QMZcQ4+QpryrlVTYGh1AglPdTEnPQpx5ytOTLyr4s2GGQKHeEeTkAMWN+ioJ?= =?us-ascii?Q?a4PBxetvVbnG05RQVQvwj5KyY+1JCLSIx70L9uAAv3kBdGdMaaa1J0aaPAu7?= =?us-ascii?Q?jnfHMSYeC+x7nWLjBK0fz00q7my9+fiUxmLpGtxC5ztIivINa6Cx1osvBK8D?= =?us-ascii?Q?QE+WZrrZsEaBeRa24KVLzPfADnI0bKfA+IU81kQRgcgd3rlSlEo2fVs5pXJf?= =?us-ascii?Q?HHPbyNuGk1zQQPys0VVH9f99mnSzUu8M/VeD9at3kDJugNYeseWW+l2FcGpZ?= =?us-ascii?Q?SjnCrb7jxriweV4mkTq0Dle/1ggqGFH8/noE31DpYYDr5OrzthIeo+gi863x?= =?us-ascii?Q?RI0WWoV7IZbS/hNMWvvQIOG4PTmKZvnd66hHy1KuHNgZnV9Id6wtQycdKijl?= =?us-ascii?Q?Rkmr745rz/A44KMBFMs4yIYnyMNWhjpVm6BSHtRkgkrnnzqmxuGfQd35svPl?= =?us-ascii?Q?mlEbyBnKuSGA8iyeYZvz/uZ3tzZzg47y1F3ZqUG8ZDmHRMvM+LWYL3wI7KEf?= =?us-ascii?Q?pEbV0OEP7uXOVKVmh0Hm/RSJ/rSX2A8AynPXs8h1M55lviw23oCF1m24tkbJ?= =?us-ascii?Q?9wBkC3Op0vjizVZpgaEJ5EJhH9Q1uPqH20vkOMHV+ivBsESrKO4nVgvb6DyM?= =?us-ascii?Q?MoeE1hDEaaK6j5Mnb7r6DWvWOanDVBDKnRTENXZdmQZGDl70fBPrknuPIlw6?= =?us-ascii?Q?4HcP7SwTO6YlYS2XZs5A3MYvB4DV3vCAM0eeHeu+d0zHyIg1imZUH0qPV7oF?= =?us-ascii?Q?M61+eBR4n3JSnHAKdPibtx5b6SbmxzVpX0Yjwo2aay74XPno381blu+n9KUb?= =?us-ascii?Q?Bt4aHvYeQqzPVLQ9IPQJfNbDi3ZzLRih4KVs/mPWPGL50vvRc3vPCgcKwYc1?= =?us-ascii?Q?NxfLhzLvXgpGb4L+xEdlPJ8bzgCLA76z?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR12MB9473.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?8bRF/rUGRAFcr9Fxm7dNaInDm+VsOSIvGRglCw/aORR/Y1UV4b6i/Bxgb/bU?= =?us-ascii?Q?CvqJ2qWiWQfkH3s/j5djyI3mc6P4AIAHt0S33T5NzjbRlu6njZObxXtw/O/B?= =?us-ascii?Q?eikC3r1VcrB/W4byfbs7elM5LOaPbfSqdFRap81YhrZuIYsLgtUBR8s0I2Mb?= =?us-ascii?Q?B976mj9C7hnb5i2Wl81Gx0cj1oVxgIdHz+hu/lmMTp8xH4Jz+FmdnIOBxGuD?= =?us-ascii?Q?nKWFkKCwII8ECMsJrnaJ9qoTNn58Lq/4pmPfbadIXYToZXAwe/wA77pIziiT?= =?us-ascii?Q?wyofB3xkeyE4vLHkSQVnN5/BPuiv2C0ZZP43CyS2U7IcvSebcAdrqXJNXZ0m?= =?us-ascii?Q?bv4WtwM480z2TQq5yEGBYL1d+ePyAmx4GhvqKdFTE+cBBqCYesYihmIdGDgW?= =?us-ascii?Q?i6mN/cto0EiPMVWmCqbawvGrpzivdmKIdYByccGDD9QVplJmqDfq8rFvJkDn?= =?us-ascii?Q?c+1jz0slcNBiWa21o2dlvRkOiUsl/IpgmuV1xwnVbKF+i9+pPClR1HwHq21Y?= =?us-ascii?Q?gltMg5LU4wplUOAJ9ocaG3XLxEXnNcFK3FtoDl/194LPLHrdiH7w0o/6xl9N?= =?us-ascii?Q?+nU5DkYSL9ozZW97iI94d4PNJKTLJUGEV0i1xhSmuyZ15ptmmQhSjWNh6pi/?= =?us-ascii?Q?CwTXo6x5kgKfV0+7VA5LpUXOIvnxt0874v1MmC+9RaRNr6Res2C50Q2pgHsW?= =?us-ascii?Q?1zgmpZpaeJhwgIl+Ync0aPv6B/t/h/Ax9UlVLrjftBa1KiOlU/qFVtd3asCj?= =?us-ascii?Q?4XrunguNG6bGWWZN8o2pVKydhHWmoXtY5s3rvD0yM472ZgruMHCuBWIBnz8P?= =?us-ascii?Q?K61sMziGLgfoy4JhUajHpYxZzdlpFFcTNN4YZ05BJzgI0kKRbpxLdniRdL7h?= =?us-ascii?Q?vAJvS7YlztoznrULuDWFwww8ruhoKKnsNMAj0ERbEJ40jFBK/WJXCgM3n6Ph?= =?us-ascii?Q?AMK+EltZy6nBigFYU+imIcEO7cro1bRwlG4BiUuNkOa3IunOPY0mRkD8MbWX?= =?us-ascii?Q?QMGWkOfcHEyyiF/vF8DvtsntjUcHeVyBk4ryHtLZ4/7uRZDvRhOTIi7wb+nv?= =?us-ascii?Q?SmVXVtK51EqZyRicyCGw3IqQKpsYL/t9IBxcUZSgBUGhzAuhfMyGAzSidFDq?= =?us-ascii?Q?x1GMg4JX6EoejMGd9AlmVRSB78AqMsEZ+fC6ZjHwrzs/fpghCWasRj9IHOGC?= =?us-ascii?Q?GXkBCPaoulPkPDwXhEt3C9eAIr3ffmVJCImNw3B58S5lgsYyMVmCSHL+6qsS?= =?us-ascii?Q?PEE9YgdV3hso98dfnEI2Q6KE4COCCwWsrhdnsJ3Bbi+gR4ybsbfF5Is2a40B?= =?us-ascii?Q?Rh5RiAbgl+MI+aqKqVBmjBMzudvWdOQfyby0fjiX6nOWCXc0KtDCBDG+IOXc?= =?us-ascii?Q?ixxoGNI2JWS3thmulY67IX7uJBOTeMLPgrnma/bo4pjDqL/GSpF5Akd2uJNy?= =?us-ascii?Q?hJi1C+3Ce20sSX4wHxA+uUXJH2COAjnrKUaygBz+WbkSr4UvZRRSSsuhhOrQ?= =?us-ascii?Q?i++DxctMM0/mpjhcpmmI0CgZazK+fioFe6sEZSHJAYHm5F3SImgwlSTOHZDE?= =?us-ascii?Q?cnB0TuIxdbHMQga/hauTgEVZCevefVFjB+Nk/6YQ?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: c12422c3-9b6c-4ff2-eff9-08de029ff79c X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB9473.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2025 17:12:01.1839 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Asi1CC/GdzBTuT7cF+4Xd7DijA5scJI3DjFzmLP85WHrWPfohGXBSizTWu0ogkvM X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8517 X-DKIM: signer='Nvidia.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -0.1 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-0.1 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: nvidia.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.80.249 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.80.249 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.80.249 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.5 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: 0 On 3 Oct 2025, at 11:30, Usama Arif wrote: > On 03/10/2025 15:08, Zi Yan wrote: >> On 3 Oct 2025, at 9:49, Lance Yang wrote: >> >>> Hey Wei, >>> >>> On 2025/10/2 09:38, Wei Yang wrote: >>>> We add pmd folio into ds_queue on the first page fault in >>>> __do_huge_pmd_anonymous_page(), so that we can split it in case of >>>> memory pressure. This should be the same for a pmd folio during wp >>>> page fault. >>>> >>>> Commit 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") mi= ss >>>> to add it to ds_queue, which means system may not reclaim enough mem= ory >>> >>> IIRC, it was commit dafff3f4c850 ("mm: split underused THPs") that >>> started unconditionally adding all new anon THPs to _deferred_list :)= >>> >>>> in case of memory pressure even the pmd folio is under used. >>>> >>>> Move deferred_split_folio() into map_anon_folio_pmd() to make the pm= d >>>> folio installation consistent. >>>> >>>> Fixes: 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") >>> >>> Shouldn't this rather be the following? >>> >>> Fixes: dafff3f4c850 ("mm: split underused THPs") >> >> Yes, I agree. In this case, this patch looks more like an optimization= >> for split underused THPs. >> >> One observation on this change is that right after zero pmd wp, the >> deferred split queue could be scanned, the newly added pmd folio will >> split since it is all zero except one subpage. This means we probably >> should allocate a base folio for zero pmd wp and map the rest to zero >> page at the beginning if split underused THP is enabled to avoid >> this long trip. The downside is that user app cannot get a pmd folio >> if it is intended to write data into the entire folio. >> >> Usama might be able to give some insight here. >> > > Thanks for CCing me Zi! > > hmm I think the downside of not having PMD folio probably outweights th= e cost of splitting > a zer-filled page? Yeah, I agree. > ofcourse I dont have any numbers to back that up, but that would be my = initial guess. > > Also: > > Acked-by: Usama Arif > > >> >>> >>> Thanks, >>> Lance >>> >>>> Signed-off-by: Wei Yang >>>> Cc: David Hildenbrand >>>> Cc: Lance Yang >>>> Cc: Dev Jain >>>> Cc: >>>> >>>> --- >>>> v2: >>>> * add fix, cc stable and put description about the flow of curren= t >>>> code >>>> * move deferred_split_folio() into map_anon_folio_pmd() >>>> --- >>>> mm/huge_memory.c | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/mm/huge_memory.c b/mm/huge_memory.c >>>> index 1b81680b4225..f13de93637bf 100644 >>>> --- a/mm/huge_memory.c >>>> +++ b/mm/huge_memory.c >>>> @@ -1232,6 +1232,7 @@ static void map_anon_folio_pmd(struct folio *f= olio, pmd_t *pmd, >>>> count_vm_event(THP_FAULT_ALLOC); >>>> count_mthp_stat(HPAGE_PMD_ORDER, MTHP_STAT_ANON_FAULT_ALLOC); >>>> count_memcg_event_mm(vma->vm_mm, THP_FAULT_ALLOC); >>>> + deferred_split_folio(folio, false); >>>> } >>>> static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *v= mf) >>>> @@ -1272,7 +1273,6 @@ static vm_fault_t __do_huge_pmd_anonymous_page= (struct vm_fault *vmf) >>>> pgtable_trans_huge_deposit(vma->vm_mm, vmf->pmd, pgtable); >>>> map_anon_folio_pmd(folio, vmf->pmd, vma, haddr); >>>> mm_inc_nr_ptes(vma->vm_mm); >>>> - deferred_split_folio(folio, false); >>>> spin_unlock(vmf->ptl); >>>> } >>>> >> >> >> Best Regards, >> Yan, Zi Best Regards, Yan, Zi From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id qElJMx3s32jdSR0AYBR5ng (envelope-from ) for ; Fri, 03 Oct 2025 15:30:37 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Fri, 03 Oct 2025 15:30:37 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v4hjx-000000084HW-1jQn for hi@josie.lol; Fri, 03 Oct 2025 15:30:37 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A728C19E544E for ; Fri, 3 Oct 2025 15:30:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B027B2376E0; Fri, 3 Oct 2025 15:30:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OaC8rsrj" X-Original-To: stable@vger.kernel.org Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF1E31AF0C8 for ; Fri, 3 Oct 2025 15:30:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759505428; cv=none; b=oSsHfRpX3xeJ6KnHmBZ6I4CJ5TYoB5Ai7tWsY57Yk1P2k+3BOOywjK+JN1Cwwajt64ukTUtsdbQcm+1DlNwLeNwAxSiuNob3i6c2Fg33oS2PO1olSuML5Imcy6bUIhbRu+t8Xg/TH4pyU6j6U2JKN1xlbIgMTPfvYZYceeSKDzU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759505428; c=relaxed/simple; bh=6Gj5Pburfupv4j5dEK3lJoGa65Xi7aVs2ZdYFTTXo8o=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=JRf8tuD5P7eOvliEAZslCeRrPDuJFWaN3fCvpPhFxrr8T6Zne0hcZMP353Yi6+BZNA6dewRw56lONBOO/cXX7sYSqJj9UJsky4E22HUT3iQFzrwU7SOAzqG1R+ILDHtjH7I+NzkeFGvgh+YHzOEVivdUQESQMoZt4YJ7OHUQfz4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OaC8rsrj; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-45b4d89217aso14995465e9.2 for ; Fri, 03 Oct 2025 08:30:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759505425; x=1760110225; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=1ThghlDWAjurOxYC98aHbkMmCDK/KWDP3RpbWxUD1rs=; b=OaC8rsrjnm6kGW8e0axxiHyfZYMD/1DQxZpGh2+fYDRI7UkFgchryg8sOGmCCK0x+J AF9YlsGCr/47bMmaHceMzoUBYsdvDCvfoTlBbeQZPT1WdBjlMzo13rohfOKJKV7H1V8V 8Gv6W2654Z9knz7Sn98eSJXwMtEfkstSn9/6z68Nf1LuH/ur8lFoTF4W3g9GkUy+GYv1 QuOZtTwheB9aycBKOoBskSB00SGsXxDRDFqib1ivv23DShiQDPtBmXQ4SVQuFBEnf+go RQNA5CY1KoyqmlPl3Ib6SkeVADmcAbSm8RA4chW5a5ulrCCQz0EYGOhtUbsZEqI+k8n7 SeWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759505425; x=1760110225; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1ThghlDWAjurOxYC98aHbkMmCDK/KWDP3RpbWxUD1rs=; b=ci7CMx8MCwYyHPiK5F8oPld9utq3sJr7BVI174gFNH8k9tUV6o7KXku7DFA3iXTUul 2HjUbHFEaSaVlxmFQjZ36VM2UyrOKlP+3FotTzjRXCL/QYkhZVD39QADE6vsktmfrW9g aotR2pqMYv19oCwQ856hlC/Kzosyt34AibpS+Vxd+XSKEmZPMXKNK+liw6Py2/C4TN9w A0OQJ51Kd7tWY40TSA5+tJOD3cEQz5S4iNt0bjPJcEdfbrHhiLKwUCQDK/GCpVn42Rtl mv30mFKAHiFQGteMFwRcfUy1ZUJI12wCd+jU6qMVIakIwFrnLS3thfz7yfz9B1jAeHJJ dVsQ== X-Forwarded-Encrypted: i=1; AJvYcCVVj2QPpK/hDFPxU+BDjsVoIcf+lpOniU3D8yyKc/p9BWhMuTkRZQMlV4DL/V+eUpEmziST6Ns=@vger.kernel.org X-Gm-Message-State: AOJu0YxJreFV8gQZ5ce7xwlfvmCIZKVMyxGdZ6sKbRVbQ2oW/KFN2h+z 4ekwbNWycw23RATVQAWxHlUgoMpLppa9EXmUk7jJyyQ+js/euF64TRJQ X-Gm-Gg: ASbGncsWUpfmln4jQs4xYv+TBevCE509fZabV9c9rNXoUffA3py+oIqM3wTjUrx0n2h HS3Np9SxUDvLSzxDz2xKrkA0fxHsEQxCvwImnY0xK09tqBQtLSSKH+KEnBEOSVWmo95cDCpvMHt 0Fznm9y1VQa+tqYpv7GBgIsJTMMdyYIEXIazJeKjXvz+iqQM4D03Thg6LF6mzM4ykDIECjSpY5M p/myAOU+RlsTkkHgpxhwEquhv5mFGgIyfWsns3el5KYc5wcX0OYAG32c8uPxN4wmlW4zVOlq3ct 7l4aCeZ7dOYwdfuJ4AXrP86WMVThjPd7KHZQzi+15uYh71hzqKmglB5LRx2JXVyQN26eZvRHmcr f24Xxsyu4DFHRgHI61GPRQmyKyEiABjTIjg88vQZ2CF9diBmzyVRxf8yH8tXO4YvcUM0PmdvlDn P7PsmPRWaCqFzXh8SnBL4+5bNgp6MQNka5HQUyVZoImg== X-Google-Smtp-Source: AGHT+IEREfLt3SJY1BFKHzWytZfJ9g4dT9ZMKAjBYAjJwr5+hXtXNDgkIQf10sLtLNpFjlYZ9kvUEA== X-Received: by 2002:a05:600c:a319:b0:46e:74cc:42b8 with SMTP id 5b1f17b1804b1-46e74cc4609mr13969235e9.17.1759505424738; Fri, 03 Oct 2025 08:30:24 -0700 (PDT) Received: from ?IPV6:2a02:6b6f:e750:1b00:1cfc:9209:4810:3ae5? ([2a02:6b6f:e750:1b00:1cfc:9209:4810:3ae5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4255d8f4abcsm8332891f8f.53.2025.10.03.08.30.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Oct 2025 08:30:23 -0700 (PDT) Message-ID: <29ac3e02-fb60-47ed-9834-033604744624@gmail.com> Date: Fri, 3 Oct 2025 16:30:23 +0100 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [Patch v2] mm/huge_memory: add pmd folio to ds_queue in do_huge_zero_wp_pmd() Content-Language: en-GB To: Zi Yan , Lance Yang Cc: Wei Yang , linux-mm@kvack.org, baolin.wang@linux.alibaba.com, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, wangkefeng.wang@huawei.com, stable@vger.kernel.org, ryan.roberts@arm.com, dev.jain@arm.com, npache@redhat.com, baohua@kernel.org, akpm@linux-foundation.org, david@redhat.com References: <20251002013825.20448-1-richard.weiyang@gmail.com> <1286D3DE-8F53-4B64-840F-A598B130DF13@nvidia.com> From: Usama Arif In-Reply-To: <1286D3DE-8F53-4B64-840F-A598B130DF13@nvidia.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.80.249 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [usamaarif642[at]gmail.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.80.249 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.80.249 listed in sa-accredit.habeas.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On 03/10/2025 15:08, Zi Yan wrote: > On 3 Oct 2025, at 9:49, Lance Yang wrote: > >> Hey Wei, >> >> On 2025/10/2 09:38, Wei Yang wrote: >>> We add pmd folio into ds_queue on the first page fault in >>> __do_huge_pmd_anonymous_page(), so that we can split it in case of >>> memory pressure. This should be the same for a pmd folio during wp >>> page fault. >>> >>> Commit 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") miss >>> to add it to ds_queue, which means system may not reclaim enough memory >> >> IIRC, it was commit dafff3f4c850 ("mm: split underused THPs") that >> started unconditionally adding all new anon THPs to _deferred_list :) >> >>> in case of memory pressure even the pmd folio is under used. >>> >>> Move deferred_split_folio() into map_anon_folio_pmd() to make the pmd >>> folio installation consistent. >>> >>> Fixes: 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") >> >> Shouldn't this rather be the following? >> >> Fixes: dafff3f4c850 ("mm: split underused THPs") > > Yes, I agree. In this case, this patch looks more like an optimization > for split underused THPs. > > One observation on this change is that right after zero pmd wp, the > deferred split queue could be scanned, the newly added pmd folio will > split since it is all zero except one subpage. This means we probably > should allocate a base folio for zero pmd wp and map the rest to zero > page at the beginning if split underused THP is enabled to avoid > this long trip. The downside is that user app cannot get a pmd folio > if it is intended to write data into the entire folio. > > Usama might be able to give some insight here. > Thanks for CCing me Zi! hmm I think the downside of not having PMD folio probably outweights the cost of splitting a zer-filled page? ofcourse I dont have any numbers to back that up, but that would be my initial guess. Also: Acked-by: Usama Arif > >> >> Thanks, >> Lance >> >>> Signed-off-by: Wei Yang >>> Cc: David Hildenbrand >>> Cc: Lance Yang >>> Cc: Dev Jain >>> Cc: >>> >>> --- >>> v2: >>> * add fix, cc stable and put description about the flow of current >>> code >>> * move deferred_split_folio() into map_anon_folio_pmd() >>> --- >>> mm/huge_memory.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/mm/huge_memory.c b/mm/huge_memory.c >>> index 1b81680b4225..f13de93637bf 100644 >>> --- a/mm/huge_memory.c >>> +++ b/mm/huge_memory.c >>> @@ -1232,6 +1232,7 @@ static void map_anon_folio_pmd(struct folio *folio, pmd_t *pmd, >>> count_vm_event(THP_FAULT_ALLOC); >>> count_mthp_stat(HPAGE_PMD_ORDER, MTHP_STAT_ANON_FAULT_ALLOC); >>> count_memcg_event_mm(vma->vm_mm, THP_FAULT_ALLOC); >>> + deferred_split_folio(folio, false); >>> } >>> static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf) >>> @@ -1272,7 +1273,6 @@ static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf) >>> pgtable_trans_huge_deposit(vma->vm_mm, vmf->pmd, pgtable); >>> map_anon_folio_pmd(folio, vmf->pmd, vma, haddr); >>> mm_inc_nr_ptes(vma->vm_mm); >>> - deferred_split_folio(folio, false); >>> spin_unlock(vmf->ptl); >>> } >>> > > > Best Regards, > Yan, Zi From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id KA6xLPbY32gMvhAAYBR5ng (envelope-from ) for ; Fri, 03 Oct 2025 14:08:54 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Fri, 03 Oct 2025 14:08:54 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v4gSs-00000005IZv-1PSA for hi@josie.lol; Fri, 03 Oct 2025 14:08:54 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 17BC8188CD8C for ; Fri, 3 Oct 2025 14:09:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 23E0B1F8908; Fri, 3 Oct 2025 14:08:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Bl9YLNzf" X-Original-To: stable@vger.kernel.org Received: from SN4PR2101CU001.outbound.protection.outlook.com (mail-southcentralusazon11012065.outbound.protection.outlook.com [40.93.195.65]) (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 6DAA77081C for ; Fri, 3 Oct 2025 14:08:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.93.195.65 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759500530; cv=fail; b=FnMSr7CKWO2qYswttExeG4CvWRgRpKUyb4oTqp3lmNQ1vs7MMBLq7D8ZBaha5SH0h6UWMnFTDKdNqh5Kxu+8ZhSZk6rxYi1pUeo5Y2LHhL0jrwG7rYfseBBMsQ1o2f/FHNwGG7Uc5+YAGpcnAa0noN75cBjFaBfI87zHIoA+2W4= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759500530; c=relaxed/simple; bh=Xf0K8Fg/BdgytkNBPVrD0/bI0Bxlms2RGOnO8lma0l0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=Eg1r7s7k6rETBRky0pJUAznhJUdWPGoVvss6osv5SZNkpARwRHJyl9IwuMXsftUJkQUYPPh5I/82416opJQzT8S3wQ9CyqCEMi4xO1F001S9ewo8/hPzzk7JC2r55scHpA9ejDGe3lL88Uu95Hth2r0mWR9QRnkEihxgBLIkH8k= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=Bl9YLNzf; arc=fail smtp.client-ip=40.93.195.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RIsv33sqiIUGqTXYgUQcxme8V1RwpLGgpqw+09Q46J+3dtksx/IMncIw9cuClE0mUzdw1j99X4+fqTf1tMxqbWR+qibmAk2SB0s3chC3fj0ijCvbRh3R+UihHfto5kfLAH882tPxUH7OJ6ClXXpSKvDQfNbjtJMgub9K8P7P8uKk3tlf6Os5uJlckIZ/HOvmD40yKnKvHcwkFIPNKvQMyirkunQGYdqzG7ML5lslaQ5NjraV9WCFMUOe7o6XiQnu8L0RwxuVLQ7un8MDorYoMs6sFQCtbSb/2bscawYeoxFN1sbgYWNIpXTgxFRNBBa8Enda7jvc/M//8fOFei1Rug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yY3Jj416rYnJxkLlUjvlgLuqQf92Pi6yH958VjH2BNo=; b=T+mjYZ4lYx92JBoWlCivZ9ZfJFkRvzN2IWyRXJaZ5Q3hafbw2ZEfKv4bQpPqtOd1H8tXoL8RufFE+LX69+LE2oTLUo+7KjSLcCCyt5tq5GCH37qDy599BfKAplByYabxq19RDZ3KSHi3zrulfY/wmZfS6WNL3KGPKeoy0A8THv/s77uozca9IyCjBi5h5np1BxW1pb6UAaXDRx1H09n6k81aicvyzEnEyYCJ8A7S9yUWPJUYDz5oVuDdSqM0+O5pQfT5ndjPsADCMfRX4BM4Ma3FlNkEMpgDdiVI8FgsrkScNR0Q+kmp6mIRagjq56lv5RPEx/FOu2rCMBdILXLTIQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yY3Jj416rYnJxkLlUjvlgLuqQf92Pi6yH958VjH2BNo=; b=Bl9YLNzfxnuXSGvfqdEkBxnON9xWTSyAiFjLFvUhDeqtcHPYOc9zcMyfRUzNviiVfPHxrtIyJC4aRgliq8DnHIBydIV0HZNDrQ0CxZ1RTCj/gF2/SL8hD6ID9ZjLBhxVPTshBEZNEkWVmMGZ5sx2APDsXLhccKcS0GbQG5ikBgrILV6MvNb6PGStTTWd/Hr+r2BZ6uMVJlvdRAFJ+B1vHdYMbt1AGnI8clqPLSpvPeWFP9Lc59JsUfPeKQVE+iuTN+b5UeBEqjrkruYNkHzsHhGW2g+sUsXRGXjhxIQgXbIMvTIHEENOh/wM13f2/uyZVCK4cDJrrKc+BoaOkv/Vsg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) by SA1PR12MB8966.namprd12.prod.outlook.com (2603:10b6:806:385::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9160.18; Fri, 3 Oct 2025 14:08:40 +0000 Received: from DS7PR12MB9473.namprd12.prod.outlook.com ([fe80::5189:ecec:d84a:133a]) by DS7PR12MB9473.namprd12.prod.outlook.com ([fe80::5189:ecec:d84a:133a%5]) with mapi id 15.20.9160.017; Fri, 3 Oct 2025 14:08:40 +0000 From: Zi Yan To: Usama Arif , Lance Yang Cc: Wei Yang , linux-mm@kvack.org, baolin.wang@linux.alibaba.com, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, wangkefeng.wang@huawei.com, stable@vger.kernel.org, ryan.roberts@arm.com, dev.jain@arm.com, npache@redhat.com, baohua@kernel.org, akpm@linux-foundation.org, david@redhat.com Subject: Re: [Patch v2] mm/huge_memory: add pmd folio to ds_queue in do_huge_zero_wp_pmd() Date: Fri, 03 Oct 2025 10:08:37 -0400 X-Mailer: MailMate (2.0r6283) Message-ID: <1286D3DE-8F53-4B64-840F-A598B130DF13@nvidia.com> In-Reply-To: References: <20251002013825.20448-1-richard.weiyang@gmail.com> Content-Type: text/plain Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: MN0PR05CA0029.namprd05.prod.outlook.com (2603:10b6:208:52c::23) To DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR12MB9473:EE_|SA1PR12MB8966:EE_ X-MS-Office365-Filtering-Correlation-Id: f3736f8b-69f3-4104-96bd-08de02865a8d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|376014|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?PSyp0Ute8LaKU8QSb8ZizCqXGWUDcLlI5e4iVhoOyJqnA3D0kcp2B0Bn7JXe?= =?us-ascii?Q?zWGLqlDEXEs8ixWFZyTRHaNOgSn7g8V4fCvuT7y3k8MobDTLMid58BzEhi1S?= =?us-ascii?Q?nlwAsb8Ra07fzBSwNNRhirZrY14ZJU3dVdzSWdUunKQ3Ip5rl/A6+1D7vKPL?= =?us-ascii?Q?WQjUhIjFW4n8ov9HIeKTpcOLWX/lz7mzClqtOiW7rig+3hxAJs8rvhEgg1zW?= =?us-ascii?Q?lPwZZ1Npj1LqbZYXUg7fECxYKmnZPjR4QutN2v4YIgDs+oeSaZZMnREQwXPa?= =?us-ascii?Q?Us+b01sNqllYxbTORuUxy2ms4FsruYdirBNKT7DjwOmzJHXoZ8Pd3lz8ivba?= =?us-ascii?Q?cqu2fD4GjT9PrVOS1CsiJ4u4hS53P2s91eeqRC/55m3sqEOQD02jCgUJvT+A?= =?us-ascii?Q?JWG/MIgxmX5uy6qm11lzaC/r3A3Idr0MjSPGrcE3fil7FLn4g8ptSu7yYeeG?= =?us-ascii?Q?NnQPBp5YeX8pJ7lHmkdO/0Z2rwb1cjj70dxkoxbUBFkfmABb2Jus7NaX6N4l?= =?us-ascii?Q?iyv0oZ071NLFuEPDqiDCK0yBePmI7zFJV+GwQ2/+JGu/XOxedG3pBd2bTVsf?= =?us-ascii?Q?eMxVXSQX79FNyBGofqBUEW3BExVrPUM/8or+JuNlymiR03TAgIOqvHBqOp9f?= =?us-ascii?Q?vpG1IGUoxSQZ9JSdFQ1KrqeXw2XCvCcaAC/NdYcliVmdGYOE5ZlcQ535BvJ5?= =?us-ascii?Q?9jeuPtiVjq+IVFAVImVo/7h6C73gy3TtduQ/3QV3I7Xe4SnazMgeQTaMS5Fv?= =?us-ascii?Q?N6cpJj4DZkov6wOJg+shkNLshSrblDG+CJp8UAmuZgTNO6o98V4vUKd4dsWm?= =?us-ascii?Q?S1hUciN8vmNNUMvq3M/Z7p9DPgDndkpix7ITMwUgde5m5nBbAFjW+hIvm6YI?= =?us-ascii?Q?Iav9MaGTv1aGB0ULUAPO+ORvydoeCSjOnOuI1jHP8knplIP+fRtWp0mXyLOQ?= =?us-ascii?Q?bt6WGI993Fzt3pZIlbDY+MqzGJ4FFJ0mDzjTlmdohlkWZqHLsCFLblmn9Y5/?= =?us-ascii?Q?6j0DxK1g2IQY6cjn/M7t/JWgpF/UF+44nRa1T5FWD1Eo5QCJ2FPahAqy4EWh?= =?us-ascii?Q?y9aeQdLVzoQNa8A9gWwIIvMEmBH1BRnBq3sEVSTRzEKUmSuIRjqMyskIigO2?= =?us-ascii?Q?bzYArFOndDNgk3rHVeKL1OtbCOuStzFgXGb1cmeulYdA4T9zdfV6VDrdq3d4?= =?us-ascii?Q?rwK4hbXWnoskCSRrTqUM52mfSsq4h/jdvJtM92MZgPIX0BQrlpwD9qXDShTP?= =?us-ascii?Q?YktyDSmVS8ZVCa3Rx8XWnxNvKGfIbT3YubUVA/17npdIfdN4wtIaQAYSW57w?= =?us-ascii?Q?fWnyueAtTW8wkq/Y87s+TiH1XS8WXDGG5OSLEaGVj6iPMu/2HfhYFPifVfjJ?= =?us-ascii?Q?s5Gtph76PedgvKkblzRCYuV8+QUpw3WXfN2WvpmrqDuFpkeQV+QyFq5wjYUd?= =?us-ascii?Q?P4vuysu7XxFqRRMs8HRWViSVFaSRKZF8?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR12MB9473.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?fqdYwv0fD/+STlH/7zQJ6D06sljaCCin2akOe9T6c6X6i1Pc/KH4VR3t4Wym?= =?us-ascii?Q?UYZPKEILS/LqCzhDHX7+mImp9umHArZz3UweqtdGADZ21OFca0YuioFIJpLW?= =?us-ascii?Q?YSYxa9VFLUYOKdg37VkghHIIoGPmsnAWNyELyrRG0h0KpSFvyTkHwLIvHvKH?= =?us-ascii?Q?3k25WEdCHXpxKzqzZVw+2kJgPF4OyIkHTzsJJ7HRWOw2l/eOMixdYMsy7O9x?= =?us-ascii?Q?CVIJ44NOoSp7OvqQHAlnx9Gc9gH0a4bkYa8ESa3N9hOO3P4oirPn2gHq70w5?= =?us-ascii?Q?2VnA0wtCkEVg/7C0K60LMSSDwPyevWh6c/nR0P4z8891CfGWJy4IwxxG2lwL?= =?us-ascii?Q?uhIMpq9DVO9oqGN8VCxVTRtTRTEisWrRYKMnLLPcZAyfzlqItkEAbeviXoRu?= =?us-ascii?Q?AFjTtiTtvCgbaPDerW3pUGHn74Waue8wjssnkYh/AmkS70171ZSdQmG7LzXX?= =?us-ascii?Q?FzZQElgrAIjSQ8p5PNDq2BIfyU+n/0ROnYmYgnQgYTYDqk3S8BmJZYTlrz5o?= =?us-ascii?Q?qc49dbEmzzfTLGV4zOFEKLGGfwXgp+/0GFyvris4eEOzvBxW4KgGc5lK2FLP?= =?us-ascii?Q?vdsv5S9Ny8iJN7K+kexCBMAzYgBjWnTHZdt8OlLfFW290Q3HGJpw6Dg6Xvo3?= =?us-ascii?Q?ayn74/SHPxweSl921ry0Tyu6Hbti5jHjw38msRVM4PsXwFfbWvC4XFYjHOsw?= =?us-ascii?Q?xIa2LhOaooW9l8BEFvR7C3XkCVfiZ5PnavBdE+hUq+5xRH5b3jsuepS8FXvZ?= =?us-ascii?Q?h5oZpGQ6CeJZYsSrjBBGi5ZB4RkNj2CItM4VsGbozB23m2fxlZSypKYO4lJ/?= =?us-ascii?Q?4QJ0a0g4pQ/NDCDzErIzgGFfKYoz0cuy6ms7fQnkF29mbGlB4P+UUQW64Jf/?= =?us-ascii?Q?6F5hfMeTjRTRLj8Zqp+PyrVrCP6Haq+sbFwN6epI5teKe2DuV7qsbwj18m+M?= =?us-ascii?Q?LDhuLMxX5Q+ar39V4UhCvgBUZpKeEdgo6rZJsIVLdutBmIPSWILo/fvhrIKS?= =?us-ascii?Q?oRg77nQ0ze/PqNrYgzYGJSoxxHDQina8SgJbnKIOaoKHLgBec4eIHx+xdXww?= =?us-ascii?Q?Dw9NheZbi43DmR5ia3QsqGqMaEh4i1GmBApI1Dm01tl9meXhSqevtD0/pg6e?= =?us-ascii?Q?BHPEHZ1RJaweoppQTvuLqUh7Frk5HNEqqExBItzsyyBiroo4k36vfHb3FH1T?= =?us-ascii?Q?CV3YSvFemb6m7Tjvu2WE5iGdQoPhfRdJ/XFHy+l2sPKTRF6Tks3FzM6RNXvZ?= =?us-ascii?Q?4v6Z8deQ+RVUclh/kXhty2lEnl4+yX1kNMhksw0pDgohGWmfqHsocZUm6xhX?= =?us-ascii?Q?j8dz063T/9iDPgaNP9kFGEa/sOJBWB1Hl6m8ryX2t9UihbzjimHZZRgB18k3?= =?us-ascii?Q?2PPvzL1+z+kRv9VibRlIJtpEfzGJfW8nUWm4gFGqWuOFV0y8rcOknLK8LLFj?= =?us-ascii?Q?XwTwTZFJyxF/7IH0/S9zzFTRXS6IkKeC+z00wr6ihfcaOZkzJhL9ng84qzSY?= =?us-ascii?Q?CabmPm7c4lcMKXFj1IGjUn3ghlahdLidjOIxQepoHdYV8SdoCXuN1HGk/9Ig?= =?us-ascii?Q?WHecrOCQlbABkoxfj3hfH/0fDK5lI6VAS/ufhFZr?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: f3736f8b-69f3-4104-96bd-08de02865a8d X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB9473.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2025 14:08:40.2543 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2aHp2dyCTucmsrBqnHoqRkn4v1i9hg9HVnOm0Jta8D+YpC247V5uItQ95bXJwl6O X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8966 X-DKIM: signer='Nvidia.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -0.1 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-0.1 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: nvidia.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.80.249 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.80.249 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.80.249 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.5 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: 0 On 3 Oct 2025, at 9:49, Lance Yang wrote: > Hey Wei, > > On 2025/10/2 09:38, Wei Yang wrote: >> We add pmd folio into ds_queue on the first page fault in >> __do_huge_pmd_anonymous_page(), so that we can split it in case of >> memory pressure. This should be the same for a pmd folio during wp >> page fault. >> >> Commit 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") miss= >> to add it to ds_queue, which means system may not reclaim enough memor= y > > IIRC, it was commit dafff3f4c850 ("mm: split underused THPs") that > started unconditionally adding all new anon THPs to _deferred_list :) > >> in case of memory pressure even the pmd folio is under used. >> >> Move deferred_split_folio() into map_anon_folio_pmd() to make the pmd >> folio installation consistent. >> >> Fixes: 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") > > Shouldn't this rather be the following? > > Fixes: dafff3f4c850 ("mm: split underused THPs") Yes, I agree. In this case, this patch looks more like an optimization for split underused THPs. One observation on this change is that right after zero pmd wp, the deferred split queue could be scanned, the newly added pmd folio will split since it is all zero except one subpage. This means we probably should allocate a base folio for zero pmd wp and map the rest to zero page at the beginning if split underused THP is enabled to avoid this long trip. The downside is that user app cannot get a pmd folio if it is intended to write data into the entire folio. Usama might be able to give some insight here. > > Thanks, > Lance > >> Signed-off-by: Wei Yang >> Cc: David Hildenbrand >> Cc: Lance Yang >> Cc: Dev Jain >> Cc: >> >> --- >> v2: >> * add fix, cc stable and put description about the flow of current >> code >> * move deferred_split_folio() into map_anon_folio_pmd() >> --- >> mm/huge_memory.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/mm/huge_memory.c b/mm/huge_memory.c >> index 1b81680b4225..f13de93637bf 100644 >> --- a/mm/huge_memory.c >> +++ b/mm/huge_memory.c >> @@ -1232,6 +1232,7 @@ static void map_anon_folio_pmd(struct folio *fol= io, pmd_t *pmd, >> count_vm_event(THP_FAULT_ALLOC); >> count_mthp_stat(HPAGE_PMD_ORDER, MTHP_STAT_ANON_FAULT_ALLOC); >> count_memcg_event_mm(vma->vm_mm, THP_FAULT_ALLOC); >> + deferred_split_folio(folio, false); >> } >> static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf= ) >> @@ -1272,7 +1273,6 @@ static vm_fault_t __do_huge_pmd_anonymous_page(s= truct vm_fault *vmf) >> pgtable_trans_huge_deposit(vma->vm_mm, vmf->pmd, pgtable); >> map_anon_folio_pmd(folio, vmf->pmd, vma, haddr); >> mm_inc_nr_ptes(vma->vm_mm); >> - deferred_split_folio(folio, false); >> spin_unlock(vmf->ptl); >> } >> Best Regards, Yan, Zi From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id SGMML3HV32hxwQ0AYBR5ng (envelope-from ) for ; Fri, 03 Oct 2025 13:53:53 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Fri, 03 Oct 2025 13:53:53 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v4gEL-00000004nKy-1vCT for hi@josie.lol; Fri, 03 Oct 2025 13:53:53 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7CAC43A7456 for ; Fri, 3 Oct 2025 13:53:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8A66223AD; Fri, 3 Oct 2025 13:53:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="pW7oUVoD" X-Original-To: stable@vger.kernel.org Received: from MW6PR02CU001.outbound.protection.outlook.com (mail-westus2azon11012070.outbound.protection.outlook.com [52.101.48.70]) (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 09A0A34BA50 for ; Fri, 3 Oct 2025 13:53:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.48.70 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759499629; cv=fail; b=PdtneIw9V/VNh0E0bpSya5LsjYN9WrtaazuWfdn+UyyqaND1ozRr7RrTw7Uk7tw0S+YmAFydOZv2AYHH1FLcwi7g39avqgP4WaxM919z4TJ+nSJr5gPFT9shcviTYqT+6D8Y8XMVI09JQOZtBKBDZ/XXvGy26jAoCmiBLwgcdKo= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759499629; c=relaxed/simple; bh=23Lcjcp79omIcjJiAiD0vlGy6mn9z6FGBTEdn58ZRuQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=jmNaeRvMNdMjvmrVinFcpDoo+SaB2U/LFBOm2NRu3+zoMOghm3ZgPGYOCJrthQSS5mqaTh2Jj6EdM8TnCcSj4XjGZiYrWWwL7Tlqd8EwICmH7eGs4sV0oMizzFgIbFWX8wOp4qhgN+4KUI8jf6yiYkULXmFpaAUt/ekebjpCBK8= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=pW7oUVoD; arc=fail smtp.client-ip=52.101.48.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ekk2OTs1lRvp0e/e5w9Noytdi393SGAf0bYh3Wk3h0tfLWo1wczSm4fjbp1bJ2vJP/2ri4F2vRvwDqJdy+Kvmp2OhBEqj/bVN0tsdf49IvbYpKW7xSHcGKjOXAEwn5JB8m3Vn+lLx1ZZAvrwPr+se4X06wKo8TjZWciubugCEY9gfJHBkBrCXdiLKBg7UJhxgPBZrHdM/T/VmuZplVitmrloucmSivcvalYTZR/LkbLSvCyewNfvKrJGjUMV9RXMSrOJFxqwHR/bFtUt4o99GfbI7hDN8EfrPjGvbI/XiV9XffaR/c1VShcJh+nirawyZHbRYDOMfZ5QIWFLXabZqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=37Fxp31Qg4Xw7xrBy/pYbBqd9F0HUtp6PN+s5xgymEg=; b=t71nmb04sBTCCP7PVsS4yCNChLlhdReAmHNPrXXa8r+sz1oDYK/WIMdyKInEZrd7vSsX5/OqwmdiZrqtd3WyVcmPkzeNNRskqjrqASPA9mN1B80oTj/R8hrsa35ILA8ou00HKZ/hDyVg8dUY8cIckuiuli+kZDItFczahaFlJjKXct8W4+R1AFx2AjwvICipH5c3U7QcDFc7dxCfSIU6RlL8AIMu5KJ3QFYex+0Yo0/7g8jplf4n8AgD7UBl45aw/RRS8zXEGhic2oyqS0UFOsbWzKMpZFfpon4aCfDSkjb+bRqYisyt996V2N03XhDK3VecEzyQTsIfzwYV3cTvdQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=37Fxp31Qg4Xw7xrBy/pYbBqd9F0HUtp6PN+s5xgymEg=; b=pW7oUVoDzLDzvzIT/6ezLibjCOknt1dYw9c6EH3kz8I6jV/68l2XZ95vfbUwvIHdAOZ6QDOoOBhnLaJFIia7e1DuArEjf5n+CFyat+cq3bIe5VfxP/gmqkvLDTIp9zL0BTMfcGPRJRKEsKSE3nONek1hK55IRE2H8+Z6WykAt2GiGSjGLiEobQG2qT37CcffckF42k1VSCCcCb0LNaGzyp2xaoiPHrd+wkM9OMQz4BnvjI9d17IKBVQlr80QTPkU8SKaonQ+EGTZXOHqade/QUbybk0qy1AEkLw7dq9vExuvLgSPTw/tT3nojtHaNhxYn6fNonqlAaUElRoB4BT1BA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) by BN5PR12MB9512.namprd12.prod.outlook.com (2603:10b6:408:2ab::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9182.16; Fri, 3 Oct 2025 13:53:40 +0000 Received: from DS7PR12MB9473.namprd12.prod.outlook.com ([fe80::5189:ecec:d84a:133a]) by DS7PR12MB9473.namprd12.prod.outlook.com ([fe80::5189:ecec:d84a:133a%5]) with mapi id 15.20.9160.017; Fri, 3 Oct 2025 13:53:38 +0000 From: Zi Yan To: Wei Yang Cc: akpm@linux-foundation.org, david@redhat.com, lorenzo.stoakes@oracle.com, baolin.wang@linux.alibaba.com, Liam.Howlett@oracle.com, npache@redhat.com, ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org, lance.yang@linux.dev, wangkefeng.wang@huawei.com, linux-mm@kvack.org, stable@vger.kernel.org Subject: Re: [Patch v2] mm/huge_memory: add pmd folio to ds_queue in do_huge_zero_wp_pmd() Date: Fri, 03 Oct 2025 09:53:36 -0400 X-Mailer: MailMate (2.0r6283) Message-ID: In-Reply-To: <20251002013825.20448-1-richard.weiyang@gmail.com> References: <20251002013825.20448-1-richard.weiyang@gmail.com> Content-Type: text/plain X-ClientProxiedBy: BLAP220CA0026.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:32c::31) To DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR12MB9473:EE_|BN5PR12MB9512:EE_ X-MS-Office365-Filtering-Correlation-Id: 919a7cd0-b3fa-4fdd-b9f6-08de0284410a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|366016|1800799024|7053199007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?E7hX76FiaDqZaBNUJ6ZL1e15s34hTNB2htIBHRF71R2gp4Rx8nLlMUTCl+Cv?= =?us-ascii?Q?waaCAGC93btUpjLsFAGtt1kU4d3C92mZC7R/Vq/RMx7PXhx3uOaphlEVlg4k?= =?us-ascii?Q?kN1WL7+AAr4Htu5i+XTyeVK+FVS7v4fb9wwAcuTVoZNDSbptD6tgFAj7nlAc?= =?us-ascii?Q?Me4xXgQysk5qax2OQc+YkLKRJVEWfXRo4UQjJOrSl+3J5aj3txNTyvYHcXyY?= =?us-ascii?Q?WNtY4xWnZpviEvGqBxR4vIhwConjzXOxaYB837BHhFAKfgwH42S5edJedzRd?= =?us-ascii?Q?RSVnLOuAUXFdS2WftbtDwPHM89KLk6x3TLQviW7FS4cGi5n1nt2h84woyC9f?= =?us-ascii?Q?hRa2z5qgCXPRUPgGEPeIKJyu0GLcntycXwekYP7Z59B4S34MiR0Npaa5QflH?= =?us-ascii?Q?8o9kV2FBsF06SD1vizfb5Fri3j2mV/Ye7ldltLvL5xJ1vlbCSDS77gI73pzu?= =?us-ascii?Q?Klfn0XYmUlfipRuM+/sZgekLxbdkILNNAmEGeGqhf5nIVJK7n0o61NaBqn5F?= =?us-ascii?Q?xh0RIXEiD5Vg9qYptY/eWxPgyVGHIo5mKZZycHiOWaYNdtviSfOUxIXBtCQE?= =?us-ascii?Q?66WsoTo/pN2oLsNyK6PCp1n9rh6H+kdYD6q4cegk5aSLXpdfCcrTkGg4HNFc?= =?us-ascii?Q?WMOSfrM/wfhFGoV/Iabx5MbRIfxrJz4RYBOzPjnCA7o1ZRBR0cUXrwMZwXBz?= =?us-ascii?Q?y7SWysdFhmQU/l1nJkG/r5LUsDxL9X/Hv9NuoTeNOE9CP+hq3SzxcY/SI2Rt?= =?us-ascii?Q?d8gmte82lGLe7jSXC/RyX4ebTy26KenLt90DpotkVbFs24NjpwZP28EDoQQp?= =?us-ascii?Q?C0l/u406W8OoskV4FRDHhbrwcRrQ3RyfJ8DnX4knQFL9lIwjDub3dIljmk3s?= =?us-ascii?Q?eupr/IWiSvVx2rF1ICUYVJEorPFINM+w8Twf/+JGUDwPHZ0yQHBJCCJkPpxP?= =?us-ascii?Q?Cdds2iNORK6Aj6+p45rx2HamKatapfKWbsL+gJl0TB/5ey/CoE86enBiJoKF?= =?us-ascii?Q?L3oq/MUdvcolMN3QvY+FaZamI5M2VbwwaetrRfZ3kyRyrLOTlSDiDlvpU+az?= =?us-ascii?Q?T7iPA5UzqeXb+qZGyqgoQ5xCyjGaYj9djNldT/VW56hoR19eKpy6nAkNHgG1?= =?us-ascii?Q?LpJ/r8HzrlTfGyhw+npXSCfPr3po7zfQegh1KXlP2uUT+yp3dwSVxXpqC7m1?= =?us-ascii?Q?VhtXNJNc4WuftQ9z7WVhmAKOVTI/BWBWM8ORVlFQj/chrAOc2sOL6v0t37ea?= =?us-ascii?Q?MHcOEKejWE3g7i+l83j/iI+Z5D2kBfKPqzF4+IZKznB16OGnWbo3f1OjHMFY?= =?us-ascii?Q?LEYdkYRuj1dZdfzD0r7zALDbCWIQLfl6UrLvrByknvwg1RCYruNjHNbYdcmz?= =?us-ascii?Q?gNI0IRw40vPBNRtnNcujfvaSQTnGWNA/nOb/q7QiHqXMGaDvDv+2xCL6dIit?= =?us-ascii?Q?1MPjV1Mg5QVuwXjCQ0TuQ1Bxt13BROXL?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR12MB9473.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(366016)(1800799024)(7053199007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?TeHE18NyAkcvyQosT7ok3E0pyDGsfanalC55yj1Q/IEnOoeZ3XT88sikPx5g?= =?us-ascii?Q?fc5wc7F11nh90v3olgWl1swtrgGE/gtVFEDfTfR3BACvfQlWMOWNtGHDemD7?= =?us-ascii?Q?rodlg6ionhtLPAlH5R2loBsPcARoMGFHCKzBvUYhHaQKoHbnG3fF0YXjlDM6?= =?us-ascii?Q?jUJdAx6MQxfK5rtT2TTgKjGPM5mDJdpcusYvqKzpSiUlPQdaA+6xR8eol9Ck?= =?us-ascii?Q?PdGz/KodnpdQ7OeJ/Ki+rmgNdV3BrumpqFsdi3PM733qKiFl/72jRV7bFK1s?= =?us-ascii?Q?4BoKmuMHPxzZCLQalxBFhlv1/4EHeP0EP8RblG7Icwz/ORht82wUAZISzvmt?= =?us-ascii?Q?gCkVYdU/+OQcGCxlT4ryUd4NSTsQ8nMOZrrM39eb9sIAp7X0sUXWjCeRsFN3?= =?us-ascii?Q?ucdW2d/eILsJWSDbJMkFUSsr837wuVCTKa4UxNCAktUCQmLlwtx2HzSIm/UG?= =?us-ascii?Q?qzgyUR4FJaVe8vDmdYBeTqFrVUwqMnB5RRu9t3QZYdDbZXfvOk4KsUMBr9CZ?= =?us-ascii?Q?9pu3ppspwoLZppQsT+2sqwxf4SKHudTG/kV05S54mspQGdC8wQBGTMNtAyr8?= =?us-ascii?Q?v5kSZxZ+XlIIAmNlHsueKm3gzhmwmeGTxSuuufu4xeD/Bzd9wA9fRNvhnn9N?= =?us-ascii?Q?Qjrjbm5To4awVC41zTaT8rQQZiWAH26wyq/95UwqS04yPBT23KMads9aFi6s?= =?us-ascii?Q?K8CYtzmofpFG32s8nQPhjO+VJoJAZIHACQK4IPXvQq4ZwvJzneFblC7VcjSe?= =?us-ascii?Q?PP/0Z/x+sUstP/RlaguICx1RYbGcF2ChU5JmnMLAyQuEGDe1wclM8FRnicon?= =?us-ascii?Q?KnB0WB8sN72Vpa/57b7/u8AJiU5/LjjCs132kkXw77MXD2/VTUHuQktBRaZ1?= =?us-ascii?Q?9kTVgm+PtusMaTJtAcvd+tRyRV8Ot9Bjz5pulRXMpX0vesxEBC1bwekEZ8Og?= =?us-ascii?Q?FgxBJliuiSva5yiGkKLaXiSp2gpIvXSyPxu9duKOuvEV2/56uwBFeJycTFYV?= =?us-ascii?Q?PyoFGVDJhWcVzDHZtnzWoKVYGYZLhagqnpylifKDrC//NYZacU4JlWG5k3Hm?= =?us-ascii?Q?OBwL489I8sfwly77b63Oaz7zo3+mFjcxKY8ZtItQHPE2LJgeWE3UXk9h6I61?= =?us-ascii?Q?Zeja0pwP24VE5TjBRwONT22mkLNcjNqisguatPJkQrGtsetIaWUiBgx7/kMy?= =?us-ascii?Q?PEsl0VCXwj2rBjDvXWrSiXGAuRzAS0XI8APXIu5T4YG0SWxWU5snhXE0h/FH?= =?us-ascii?Q?goKfpnFWa42LObZMFnuuHpvy/r/oN9XFG0e+Gyi4aMWUfLrj36f2PxnA284s?= =?us-ascii?Q?GVAiwjxLg7H6sEQSXBzODqeGbazyUxQJryg+7UF5Pd5hClm5H91IE0uPQ3nB?= =?us-ascii?Q?etmre84qAKMiwK9VPbdIA4kZdjqpEvWWCM2UGCHBBC7JGMuRSS52GB1yYZpG?= =?us-ascii?Q?JnvGB1KaBQLEGcU7ljSuiNhw8rgEOI0MP5KhWCA4OB077aRa6ueOeQYqXabw?= =?us-ascii?Q?GUEtsDRayLd+fWUz2HF8P9mBtB+z7uVNfZwCTXyqcHEvFqDf5nBOJ7P4Fm6o?= =?us-ascii?Q?dGCgbKDYfQuFEL2IxPoRmqd3Nc6k6cT2X2u5ESzx?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 919a7cd0-b3fa-4fdd-b9f6-08de0284410a X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB9473.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2025 13:53:38.5335 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1Msa5FVnlstFJsFTW1hOW2ag4Y1m6SQDKqhe0192nfyx1LT1yZ2JqtVASYmyQvec X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN5PR12MB9512 X-DKIM: signer='Nvidia.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -0.1 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-0.1 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: nvidia.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.178.88.99 listed in bl.score.senderscore.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.178.88.99 listed in sa-accredit.habeas.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.5 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: 0 On 1 Oct 2025, at 21:38, Wei Yang wrote: > We add pmd folio into ds_queue on the first page fault in > __do_huge_pmd_anonymous_page(), so that we can split it in case of > memory pressure. This should be the same for a pmd folio during wp > page fault. > > Commit 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") miss > to add it to ds_queue, which means system may not reclaim enough memory > in case of memory pressure even the pmd folio is under used. > > Move deferred_split_folio() into map_anon_folio_pmd() to make the pmd > folio installation consistent. > > Fixes: 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") > Signed-off-by: Wei Yang > Cc: David Hildenbrand > Cc: Lance Yang > Cc: Dev Jain > Cc: > > --- > v2: > * add fix, cc stable and put description about the flow of current > code > * move deferred_split_folio() into map_anon_folio_pmd() > --- > mm/huge_memory.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) LGTM. Reviewed-by: Zi Yan Best Regards, Yan, Zi From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id CE/YJX/U32hXwQ0AYBR5ng (envelope-from ) for ; Fri, 03 Oct 2025 13:49:51 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Fri, 03 Oct 2025 13:49:51 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v4gAR-00000004eAa-0adc for hi@josie.lol; Fri, 03 Oct 2025 13:49:51 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 3123A4E37AA for ; Fri, 3 Oct 2025 13:49:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 51119537E9; Fri, 3 Oct 2025 13:49:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="iMS901TJ" X-Original-To: stable@vger.kernel.org Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (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 E5E56134BD for ; Fri, 3 Oct 2025 13:49:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.183 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759499387; cv=none; b=EXqo6pOwLpcgO1Ue+7cBXiuc8OH0wSqf2zdeb48FbssbR2JnWx7A2xG4w17uIjWu/hlycdNDTOgTMkWyn9dpuYnqi8AMg3Am+eXdYg5LH55C5LO0wxluWgz1wmiGXKcw2sZPKN/ecLTP16yvHUwSbq9aDpN20w+g1ylnfF9bpV8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759499387; c=relaxed/simple; bh=ltOfk9/oigyxPNEs7cigl7qhUXMxN4/fNEU7LKXx2FQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=E+qGch0nU6COdHrOJ39prn8Z75gdPEQgSD9NbHhqVJN/U+0R5QpJ84s0y0XLlLPmRbn2lKGsneE0fhddehkqWj5DFbczy2F5rY0MVg2VGQ6u9IUOBPCrSy7Dj3SVrZFibY0YpNXi6jYf0073RgG2/Dkd/EuPFwne2i+Gzivh6e0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=iMS901TJ; arc=none smtp.client-ip=91.218.175.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1759499382; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1O4lGRBUIO8tMHHDJsnRMdq/TLfJSS09aZziMz7CPOo=; b=iMS901TJmkXV6yhuEmITcV9H9/1QSDuf7iyoTHlxjbI7yzc8sOXgRL4HpfNEJI4k4vF+8K SNUi5sAKcTdp2Fj8BHxwrCU38Mnz4T5nKS4QjqdxdSB9l7OYu+kEJgEdqyvrY4xgS3dgdA PbsZWQ2G1tPlvaK0Q0rurQ3k0NP08Cc= Date: Fri, 3 Oct 2025 21:49:28 +0800 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [Patch v2] mm/huge_memory: add pmd folio to ds_queue in do_huge_zero_wp_pmd() Content-Language: en-US To: Wei Yang Cc: linux-mm@kvack.org, baolin.wang@linux.alibaba.com, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, wangkefeng.wang@huawei.com, stable@vger.kernel.org, ziy@nvidia.com, ryan.roberts@arm.com, dev.jain@arm.com, npache@redhat.com, baohua@kernel.org, akpm@linux-foundation.org, david@redhat.com References: <20251002013825.20448-1-richard.weiyang@gmail.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Lance Yang In-Reply-To: <20251002013825.20448-1-richard.weiyang@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-DKIM: signer='linux.dev' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in sa-accredit.habeas.com] 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linux.dev] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 Hey Wei, On 2025/10/2 09:38, Wei Yang wrote: > We add pmd folio into ds_queue on the first page fault in > __do_huge_pmd_anonymous_page(), so that we can split it in case of > memory pressure. This should be the same for a pmd folio during wp > page fault. > > Commit 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") miss > to add it to ds_queue, which means system may not reclaim enough memory IIRC, it was commit dafff3f4c850 ("mm: split underused THPs") that started unconditionally adding all new anon THPs to _deferred_list :) > in case of memory pressure even the pmd folio is under used. > > Move deferred_split_folio() into map_anon_folio_pmd() to make the pmd > folio installation consistent. > > Fixes: 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") Shouldn't this rather be the following? Fixes: dafff3f4c850 ("mm: split underused THPs") Thanks, Lance > Signed-off-by: Wei Yang > Cc: David Hildenbrand > Cc: Lance Yang > Cc: Dev Jain > Cc: > > --- > v2: > * add fix, cc stable and put description about the flow of current > code > * move deferred_split_folio() into map_anon_folio_pmd() > --- > mm/huge_memory.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > index 1b81680b4225..f13de93637bf 100644 > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c > @@ -1232,6 +1232,7 @@ static void map_anon_folio_pmd(struct folio *folio, pmd_t *pmd, > count_vm_event(THP_FAULT_ALLOC); > count_mthp_stat(HPAGE_PMD_ORDER, MTHP_STAT_ANON_FAULT_ALLOC); > count_memcg_event_mm(vma->vm_mm, THP_FAULT_ALLOC); > + deferred_split_folio(folio, false); > } > > static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf) > @@ -1272,7 +1273,6 @@ static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf) > pgtable_trans_huge_deposit(vma->vm_mm, vmf->pmd, pgtable); > map_anon_folio_pmd(folio, vmf->pmd, vma, haddr); > mm_inc_nr_ptes(vma->vm_mm); > - deferred_split_folio(folio, false); > spin_unlock(vmf->ptl); > } > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id uCGhKmeB32iMFSYAYBR5ng (envelope-from ) for ; Fri, 03 Oct 2025 07:55:19 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Fri, 03 Oct 2025 07:55:19 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v4adL-0000000AYJL-14yv for hi@josie.lol; Fri, 03 Oct 2025 07:55:19 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 186ED1895976 for ; Fri, 3 Oct 2025 07:55:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8D3D225E824; Fri, 3 Oct 2025 07:55:14 +0000 (UTC) X-Original-To: stable@vger.kernel.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AE2C32475CB for ; Fri, 3 Oct 2025 07:55:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759478114; cv=none; b=mGoDGYamb52UE+YkghXPM5+yxg+dDvJ5fkr70nzNmpjlWcE2YLfdn4J37xZ5OE7z9Xl1FlTC+phVygNdwwi5W6JX+ibSTZVtxFrspoW9INdiroGt526Oxweuy19LFSceblHC3OYdfdrbQcAcVLa7xLHTodGPvNcjs6dGpnewZI0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759478114; c=relaxed/simple; bh=ZUqhVd7vcsVc1CWlD0NUVC7kP7EMWB7/YDrJRnN/yu4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=oWOrgfsZkbXBiRjzTxuH6Jab8TB3/1WlzCOp/IBjCC0XGo8taioD+fwy570Mo36KS0SgJYC+6eyucDPilsSyHckv98VjpycXrOjoUIVbIiBWBbtED12ciO3KQP5K2A5LB5x0tRem1xXWkht+doJXqSG77PhyfpUt7SVxzWBbsGI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9CD081655; Fri, 3 Oct 2025 00:54:59 -0700 (PDT) Received: from [10.163.66.2] (unknown [10.163.66.2]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 226B33F5A1; Fri, 3 Oct 2025 00:55:01 -0700 (PDT) Message-ID: <36c12f7e-b55c-4f8c-998f-ba7a99a050aa@arm.com> Date: Fri, 3 Oct 2025 13:24:57 +0530 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [Patch v2] mm/huge_memory: add pmd folio to ds_queue in do_huge_zero_wp_pmd() To: Wei Yang , akpm@linux-foundation.org, david@redhat.com, lorenzo.stoakes@oracle.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com, Liam.Howlett@oracle.com, npache@redhat.com, ryan.roberts@arm.com, baohua@kernel.org, lance.yang@linux.dev, wangkefeng.wang@huawei.com Cc: linux-mm@kvack.org, stable@vger.kernel.org References: <20251002013825.20448-1-richard.weiyang@gmail.com> Content-Language: en-US From: Dev Jain In-Reply-To: <20251002013825.20448-1-richard.weiyang@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.8 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.8 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.80.249 listed in sa-accredit.habeas.com] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [147.75.80.249 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.80.249 listed in bl.score.senderscore.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: -17 On 02/10/25 7:08 am, Wei Yang wrote: > We add pmd folio into ds_queue on the first page fault in > __do_huge_pmd_anonymous_page(), so that we can split it in case of > memory pressure. This should be the same for a pmd folio during wp > page fault. > > Commit 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") miss > to add it to ds_queue, which means system may not reclaim enough memory > in case of memory pressure even the pmd folio is under used. > > Move deferred_split_folio() into map_anon_folio_pmd() to make the pmd > folio installation consistent. > > Fixes: 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") > Signed-off-by: Wei Yang > Cc: David Hildenbrand > Cc: Lance Yang > Cc: Dev Jain > Cc: > > --- Thanks! Reviewed-by: Dev Jain From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id AHBADnQp3mjPmywAYBR5ng (envelope-from ) for ; Thu, 02 Oct 2025 07:27:48 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Thu, 02 Oct 2025 07:27:48 +0000 Received: from sy.mirrors.kernel.org ([147.75.48.161]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v4Dj9-0000000Eyp9-2UoK for hi@josie.lol; Thu, 02 Oct 2025 07:27:48 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id A737F7B3070 for ; Thu, 2 Oct 2025 07:26:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6AD7A33F6; Thu, 2 Oct 2025 07:27:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="IJuo9suh" X-Original-To: stable@vger.kernel.org Received: from out-187.mta1.migadu.com (out-187.mta1.migadu.com [95.215.58.187]) (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 0101B2C029B for ; Thu, 2 Oct 2025 07:27:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759390060; cv=none; b=nnjovFKYsGoCf3YR+2kIZMoN4JZ4AnrahEpWxRca78eqxe/wJLlg0K9y3apxbViwCzOb0qBmwVMY0BYG++8Qn2Q24Rb77PwIxpU3lQk9Wc0umfi0Azm8IQ/RJAikNjboGnB5kDVYvCnF2Di7E8x9p+a7ZMxIw/+Uo+WWLH4qNIA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759390060; c=relaxed/simple; bh=E0O3pTQIzDNGpJ6hxldJ9njEUqHefl8QuY2JfvtB1KA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=tsIbYD9c9/8NGjDzHp0A/NC8zw2AgKJ31ZRpFKZj0OYaj7XcetPGy2D0uKEXvBySsgYvn2warSMxQMCGADBXl1HQY/AD5VJvACUlq1nEQ6IYHS2VIZiQLKZeVy0gUtFONWRtHkSgnLeFEYHRLXWdSIZ+7lUaGE/CQ5lZ0jN+jcc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=IJuo9suh; arc=none smtp.client-ip=95.215.58.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: <51e0b689-02fa-465c-896b-1178497085c6@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1759390055; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tf8z5q3IrTjEa1scLQkDrmTv4dYy/I6ofHkuRkCTr8Q=; b=IJuo9suhBO7mPis8m/CD6PeN8fi++MYV7WCQCMrD+3fBnQ2nStg/ZIQ1fcND3dOuHF5LnZ Pc9R2lIccS0rdH4i04CauQvPVxWXPyEgI5aIeZPyDSJJoPCMhgQDA9LcdSgxAO7VvYt9oD yIMmVHgtsWlaUu9WrRdYTbop2IYsCno= Date: Thu, 2 Oct 2025 15:27:33 +0800 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [Patch v2] mm/huge_memory: add pmd folio to ds_queue in do_huge_zero_wp_pmd() Content-Language: en-US To: Wei Yang , David Hildenbrand Cc: akpm@linux-foundation.org, lorenzo.stoakes@oracle.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com, Liam.Howlett@oracle.com, npache@redhat.com, ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org, wangkefeng.wang@huawei.com, linux-mm@kvack.org, stable@vger.kernel.org References: <20251002013825.20448-1-richard.weiyang@gmail.com> <20251002014604.d2ryohvtrdfn7mvf@master> <20251002031743.4anbofbyym5tlwrt@master> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Lance Yang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-DKIM: signer='linux.dev' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linux.dev] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.48.161 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.48.161 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.48.161 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On 2025/10/2 15:16, David Hildenbrand wrote: > On 02.10.25 05:17, Wei Yang wrote: >> On Thu, Oct 02, 2025 at 10:31:53AM +0800, Lance Yang wrote: >>> >>> >>> On 2025/10/2 09:46, Wei Yang wrote: >>>> On Thu, Oct 02, 2025 at 01:38:25AM +0000, Wei Yang wrote: >>>>> We add pmd folio into ds_queue on the first page fault in >>>>> __do_huge_pmd_anonymous_page(), so that we can split it in case of >>>>> memory pressure. This should be the same for a pmd folio during wp >>>>> page fault. >>>>> >>>>> Commit 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") miss >>>>> to add it to ds_queue, which means system may not reclaim enough >>>>> memory >>>>> in case of memory pressure even the pmd folio is under used. >>>>> >>>>> Move deferred_split_folio() into map_anon_folio_pmd() to make the pmd >>>>> folio installation consistent. >>>>> >>>> >>>> Since we move deferred_split_folio() into map_anon_folio_pmd(), I am >>>> thinking >>>> about whether we can consolidate the process in collapse_huge_page(). >>>> >>>> Use map_anon_folio_pmd() in collapse_huge_page(), but skip those >>>> statistic >>>> adjustment. >>> >>> Yeah, that's a good idea :) >>> >>> We could add a simple bool is_fault parameter to map_anon_folio_pmd() >>> to control the statistics. >>> >>> The fault paths would call it with true, and the collapse paths could >>> then call it with false. >>> >>> Something like this: >>> >>> ``` >>> diff --git a/mm/huge_memory.c b/mm/huge_memory.c >>> index 1b81680b4225..9924180a4a56 100644 >>> --- a/mm/huge_memory.c >>> +++ b/mm/huge_memory.c >>> @@ -1218,7 +1218,7 @@ static struct folio >>> *vma_alloc_anon_folio_pmd(struct >>> vm_area_struct *vma, >>> } >>> >>> static void map_anon_folio_pmd(struct folio *folio, pmd_t *pmd, >>> -        struct vm_area_struct *vma, unsigned long haddr) >>> +        struct vm_area_struct *vma, unsigned long haddr, bool is_fault) >>> { >>>     pmd_t entry; >>> >>> @@ -1228,10 +1228,15 @@ static void map_anon_folio_pmd(struct folio >>> *folio, >>> pmd_t *pmd, >>>     folio_add_lru_vma(folio, vma); >>>     set_pmd_at(vma->vm_mm, haddr, pmd, entry); >>>     update_mmu_cache_pmd(vma, haddr, pmd); >>> -    add_mm_counter(vma->vm_mm, MM_ANONPAGES, HPAGE_PMD_NR); >>> -    count_vm_event(THP_FAULT_ALLOC); >>> -    count_mthp_stat(HPAGE_PMD_ORDER, MTHP_STAT_ANON_FAULT_ALLOC); >>> -    count_memcg_event_mm(vma->vm_mm, THP_FAULT_ALLOC); >>> + >>> +    if (is_fault) { >>> +        add_mm_counter(vma->vm_mm, MM_ANONPAGES, HPAGE_PMD_NR); >>> +        count_vm_event(THP_FAULT_ALLOC); >>> +        count_mthp_stat(HPAGE_PMD_ORDER, MTHP_STAT_ANON_FAULT_ALLOC); >>> +        count_memcg_event_mm(vma->vm_mm, THP_FAULT_ALLOC); >>> +    } >>> + >>> +    deferred_split_folio(folio, false); >>> } >>> >>> static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf) >>> diff --git a/mm/khugepaged.c b/mm/khugepaged.c >>> index d0957648db19..2eddd5a60e48 100644 >>> --- a/mm/khugepaged.c >>> +++ b/mm/khugepaged.c >>> @@ -1227,17 +1227,10 @@ static int collapse_huge_page(struct >>> mm_struct *mm, >>> unsigned long address, >>>     __folio_mark_uptodate(folio); >>>     pgtable = pmd_pgtable(_pmd); >>> >>> -    _pmd = folio_mk_pmd(folio, vma->vm_page_prot); >>> -    _pmd = maybe_pmd_mkwrite(pmd_mkdirty(_pmd), vma); >>> - >>>     spin_lock(pmd_ptl); >>>     BUG_ON(!pmd_none(*pmd)); >>> -    folio_add_new_anon_rmap(folio, vma, address, RMAP_EXCLUSIVE); >>> -    folio_add_lru_vma(folio, vma); >>>     pgtable_trans_huge_deposit(mm, pmd, pgtable); >>> -    set_pmd_at(mm, address, pmd, _pmd); >>> -    update_mmu_cache_pmd(vma, address, pmd); >>> -    deferred_split_folio(folio, false); >>> +    map_anon_folio_pmd(folio, pmd, vma, address, false); >>>     spin_unlock(pmd_ptl); >>> >>>     folio = NULL; >>> ``` >>> >>> Untested, though. >>> >> >> This is the same as I thought. >> >> Will prepare a patch for it. > > Let's do that as an add-on patch, though. Yeah, let’s do that separately ;) From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id sLxyDHIp3miL0i0AYBR5ng (envelope-from ) for ; Thu, 02 Oct 2025 07:27:46 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Thu, 02 Oct 2025 07:27:46 +0000 Received: from ny.mirrors.kernel.org ([147.75.199.223]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v4Dj7-0000000Eyop-3Ibj for hi@josie.lol; Thu, 02 Oct 2025 07:27:46 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 13F36322DAD for ; Thu, 2 Oct 2025 07:27:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D3702C11C3; Thu, 2 Oct 2025 07:27:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="I7m7p2Kd" X-Original-To: stable@vger.kernel.org Received: from out-173.mta1.migadu.com (out-173.mta1.migadu.com [95.215.58.173]) (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 242BC2C08C5 for ; Thu, 2 Oct 2025 07:27:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759390064; cv=none; b=dfCzh/Ibr5cnWQOI2brJrsj+2seq5JrjYsdDZ0MLSqgR4N+dHlj7NuTQnYM/Igz3a7zRocQtbfUdVBYruVrTtwxzce76ojFVv4L5iG85g8ir33EECHvIf7F11zJj0EGhzeI0VsdLsVn35CmjpD4RcWW/muRQfgDsqTQWR9trYtQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759390064; c=relaxed/simple; bh=E0O3pTQIzDNGpJ6hxldJ9njEUqHefl8QuY2JfvtB1KA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=AFGTYWc0C62CqNGmXZiHLjMEPEhouxxNlZEveX7xG5oWrVURiUdcU8lLZDc/IuFVyz1NtUEqpPzkqP2mZuZR0uYelXsYG6evStS7dFtT0Z7vxAfDdAurCp0YnT7XACmwvKs8VcFKAmYnwy/3qUSjHEmNdpIySLYkEKiEYUhJU/M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=I7m7p2Kd; arc=none smtp.client-ip=95.215.58.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: <51e0b689-02fa-465c-896b-1178497085c6@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1759390060; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tf8z5q3IrTjEa1scLQkDrmTv4dYy/I6ofHkuRkCTr8Q=; b=I7m7p2Kd817cIsaAJb9eSW7jpXSdGDewMdzS5u6oj/QuFuKiQWcxfwN2BkkzJyT/MRT46K 3msA7XJ25s+FZvio5MGaMCyIPPWvaPetXpxc62LH+k0mK8gFPwQiF2YIkEPVsD0grdRgCb dDyMSOrJefEuRKSNi09OgUugxGQ6Wqc= Date: Thu, 2 Oct 2025 15:27:33 +0800 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [Patch v2] mm/huge_memory: add pmd folio to ds_queue in do_huge_zero_wp_pmd() Content-Language: en-US To: Wei Yang , David Hildenbrand Cc: akpm@linux-foundation.org, lorenzo.stoakes@oracle.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com, Liam.Howlett@oracle.com, npache@redhat.com, ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org, wangkefeng.wang@huawei.com, linux-mm@kvack.org, stable@vger.kernel.org References: <20251002013825.20448-1-richard.weiyang@gmail.com> <20251002014604.d2ryohvtrdfn7mvf@master> <20251002031743.4anbofbyym5tlwrt@master> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Lance Yang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-DKIM: signer='linux.dev' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linux.dev] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.199.223 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.199.223 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.199.223 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On 2025/10/2 15:16, David Hildenbrand wrote: > On 02.10.25 05:17, Wei Yang wrote: >> On Thu, Oct 02, 2025 at 10:31:53AM +0800, Lance Yang wrote: >>> >>> >>> On 2025/10/2 09:46, Wei Yang wrote: >>>> On Thu, Oct 02, 2025 at 01:38:25AM +0000, Wei Yang wrote: >>>>> We add pmd folio into ds_queue on the first page fault in >>>>> __do_huge_pmd_anonymous_page(), so that we can split it in case of >>>>> memory pressure. This should be the same for a pmd folio during wp >>>>> page fault. >>>>> >>>>> Commit 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") miss >>>>> to add it to ds_queue, which means system may not reclaim enough >>>>> memory >>>>> in case of memory pressure even the pmd folio is under used. >>>>> >>>>> Move deferred_split_folio() into map_anon_folio_pmd() to make the pmd >>>>> folio installation consistent. >>>>> >>>> >>>> Since we move deferred_split_folio() into map_anon_folio_pmd(), I am >>>> thinking >>>> about whether we can consolidate the process in collapse_huge_page(). >>>> >>>> Use map_anon_folio_pmd() in collapse_huge_page(), but skip those >>>> statistic >>>> adjustment. >>> >>> Yeah, that's a good idea :) >>> >>> We could add a simple bool is_fault parameter to map_anon_folio_pmd() >>> to control the statistics. >>> >>> The fault paths would call it with true, and the collapse paths could >>> then call it with false. >>> >>> Something like this: >>> >>> ``` >>> diff --git a/mm/huge_memory.c b/mm/huge_memory.c >>> index 1b81680b4225..9924180a4a56 100644 >>> --- a/mm/huge_memory.c >>> +++ b/mm/huge_memory.c >>> @@ -1218,7 +1218,7 @@ static struct folio >>> *vma_alloc_anon_folio_pmd(struct >>> vm_area_struct *vma, >>> } >>> >>> static void map_anon_folio_pmd(struct folio *folio, pmd_t *pmd, >>> -        struct vm_area_struct *vma, unsigned long haddr) >>> +        struct vm_area_struct *vma, unsigned long haddr, bool is_fault) >>> { >>>     pmd_t entry; >>> >>> @@ -1228,10 +1228,15 @@ static void map_anon_folio_pmd(struct folio >>> *folio, >>> pmd_t *pmd, >>>     folio_add_lru_vma(folio, vma); >>>     set_pmd_at(vma->vm_mm, haddr, pmd, entry); >>>     update_mmu_cache_pmd(vma, haddr, pmd); >>> -    add_mm_counter(vma->vm_mm, MM_ANONPAGES, HPAGE_PMD_NR); >>> -    count_vm_event(THP_FAULT_ALLOC); >>> -    count_mthp_stat(HPAGE_PMD_ORDER, MTHP_STAT_ANON_FAULT_ALLOC); >>> -    count_memcg_event_mm(vma->vm_mm, THP_FAULT_ALLOC); >>> + >>> +    if (is_fault) { >>> +        add_mm_counter(vma->vm_mm, MM_ANONPAGES, HPAGE_PMD_NR); >>> +        count_vm_event(THP_FAULT_ALLOC); >>> +        count_mthp_stat(HPAGE_PMD_ORDER, MTHP_STAT_ANON_FAULT_ALLOC); >>> +        count_memcg_event_mm(vma->vm_mm, THP_FAULT_ALLOC); >>> +    } >>> + >>> +    deferred_split_folio(folio, false); >>> } >>> >>> static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf) >>> diff --git a/mm/khugepaged.c b/mm/khugepaged.c >>> index d0957648db19..2eddd5a60e48 100644 >>> --- a/mm/khugepaged.c >>> +++ b/mm/khugepaged.c >>> @@ -1227,17 +1227,10 @@ static int collapse_huge_page(struct >>> mm_struct *mm, >>> unsigned long address, >>>     __folio_mark_uptodate(folio); >>>     pgtable = pmd_pgtable(_pmd); >>> >>> -    _pmd = folio_mk_pmd(folio, vma->vm_page_prot); >>> -    _pmd = maybe_pmd_mkwrite(pmd_mkdirty(_pmd), vma); >>> - >>>     spin_lock(pmd_ptl); >>>     BUG_ON(!pmd_none(*pmd)); >>> -    folio_add_new_anon_rmap(folio, vma, address, RMAP_EXCLUSIVE); >>> -    folio_add_lru_vma(folio, vma); >>>     pgtable_trans_huge_deposit(mm, pmd, pgtable); >>> -    set_pmd_at(mm, address, pmd, _pmd); >>> -    update_mmu_cache_pmd(vma, address, pmd); >>> -    deferred_split_folio(folio, false); >>> +    map_anon_folio_pmd(folio, pmd, vma, address, false); >>>     spin_unlock(pmd_ptl); >>> >>>     folio = NULL; >>> ``` >>> >>> Untested, though. >>> >> >> This is the same as I thought. >> >> Will prepare a patch for it. > > Let's do that as an add-on patch, though. Yeah, let’s do that separately ;) From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id ACkOAB0p3miexDEAYBR5ng (envelope-from ) for ; Thu, 02 Oct 2025 07:26:21 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Thu, 02 Oct 2025 07:26:21 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v4Dhk-0000000EugZ-1XYY for hi@josie.lol; Thu, 02 Oct 2025 07:26:20 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6F70B3C1D8E for ; Thu, 2 Oct 2025 07:26:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E717B224AF0; Thu, 2 Oct 2025 07:26:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="loFmx088" X-Original-To: stable@vger.kernel.org Received: from out-178.mta0.migadu.com (out-178.mta0.migadu.com [91.218.175.178]) (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 27C6833F6 for ; Thu, 2 Oct 2025 07:26:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759389976; cv=none; b=GOTOC2++IRuu/ppyPKM3hXaARoVn2lx6z/aHb95z8JRKNvvvkFrjrOIco0omFCFyyvZkQ2MuIe7GBnGXqRorj0YXd4UywjpxLMBHvsyyywKoByyOqyXTzlukim6p/WkCDdE/WXlK1r636h/ZA6J/o7F+wznMCv9fX1hoFRyA7+4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759389976; c=relaxed/simple; bh=2W4uiY8ft3y/Z+5ko7tsg8AH03/ohFyUdLkL1/HsEVA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=r22NIH5EH7KAW1XBYmkfRS5KGJxkq2Cm3sbPaZ/D2beBux2oytre/THm7DSE6Yshy2ShKSFB6KtMnnrDtWom7+yyr0BCP1RtxfonUwwRVAf7ydiJus1txlNoAOexnfXphfd3wqgfjoR2SvZQm5RPtXtQMNAxING1Ar8PBiIcjMc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=loFmx088; arc=none smtp.client-ip=91.218.175.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1759389971; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wcfqctUWyMyKjwwrVZORei8dkKTWNNNgmJPwVrqv29Y=; b=loFmx0885gwXjnfIOCVEplFjluOdPJ+4irqQ3udyeTsxUCFyE9/aKOMTcQGJipS4gutdlD JKieqM6UTA3YPS8U1/l3j+/HvX4J4v5g9LWuRj9MABc3ed/X6W/QiRQCHOIXJbHw4jJmgp 348lCGCcsfsBDoVc2k11eeV3ojgVJK8= Date: Thu, 2 Oct 2025 15:26:02 +0800 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [Patch v2] mm/huge_memory: add pmd folio to ds_queue in do_huge_zero_wp_pmd() Content-Language: en-US To: Wei Yang Cc: linux-mm@kvack.org, stable@vger.kernel.org, npache@redhat.com, lorenzo.stoakes@oracle.com, baohua@kernel.org, ziy@nvidia.com, dev.jain@arm.com, wangkefeng.wang@huawei.com, baolin.wang@linux.alibaba.com, david@redhat.com, ryan.roberts@arm.com, Liam.Howlett@oracle.com, akpm@linux-foundation.org References: <20251002013825.20448-1-richard.weiyang@gmail.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Lance Yang In-Reply-To: <20251002013825.20448-1-richard.weiyang@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-DKIM: signer='linux.dev' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [139.178.88.99 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.178.88.99 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.178.88.99 listed in sa-accredit.habeas.com] 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linux.dev] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: -18 On 2025/10/2 09:38, Wei Yang wrote: > We add pmd folio into ds_queue on the first page fault in > __do_huge_pmd_anonymous_page(), so that we can split it in case of > memory pressure. This should be the same for a pmd folio during wp > page fault. > > Commit 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") miss > to add it to ds_queue, which means system may not reclaim enough memory > in case of memory pressure even the pmd folio is under used. > > Move deferred_split_folio() into map_anon_folio_pmd() to make the pmd > folio installation consistent. > > Fixes: 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") > Signed-off-by: Wei Yang > Cc: David Hildenbrand > Cc: Lance Yang > Cc: Dev Jain > Cc: Cool. LGTM. Reviewed-by: Lance Yang > > --- > v2: > * add fix, cc stable and put description about the flow of current > code > * move deferred_split_folio() into map_anon_folio_pmd() > --- > mm/huge_memory.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > index 1b81680b4225..f13de93637bf 100644 > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c > @@ -1232,6 +1232,7 @@ static void map_anon_folio_pmd(struct folio *folio, pmd_t *pmd, > count_vm_event(THP_FAULT_ALLOC); > count_mthp_stat(HPAGE_PMD_ORDER, MTHP_STAT_ANON_FAULT_ALLOC); > count_memcg_event_mm(vma->vm_mm, THP_FAULT_ALLOC); > + deferred_split_folio(folio, false); > } > > static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf) > @@ -1272,7 +1273,6 @@ static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf) > pgtable_trans_huge_deposit(vma->vm_mm, vmf->pmd, pgtable); > map_anon_folio_pmd(folio, vmf->pmd, vma, haddr); > mm_inc_nr_ptes(vma->vm_mm); > - deferred_split_folio(folio, false); > spin_unlock(vmf->ptl); > } > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id GBOkJtUm3mgtdCsAYBR5ng (envelope-from ) for ; Thu, 02 Oct 2025 07:16:37 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Thu, 02 Oct 2025 07:16:37 +0000 Received: from ny.mirrors.kernel.org ([147.75.199.223]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v4DYL-0000000EYq8-1kqk for hi@josie.lol; Thu, 02 Oct 2025 07:16:37 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6BDC416F4F4 for ; Thu, 2 Oct 2025 07:16:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 45AFE136351; Thu, 2 Oct 2025 07:16:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="YlspaazB" X-Original-To: stable@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 8EB4446B5 for ; Thu, 2 Oct 2025 07:16:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759389394; cv=none; b=V2PVKikYX2uqKnnieqPkDlPyW2SQ2RTHSUHlRE7ajUXMHtf9gOKfgaDQ0/qsEfvJl/ws4ngoeQfsx5VUcwh+FLah82yuUwJdz78ZDINo5OwMkhU8JOOZMdnehLR9opZKRn4XRd9Qjp4gkkVXW7Iv+JRr4gCktMaSef3p+dD7UHg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759389394; c=relaxed/simple; bh=n5ZSxNO4t/TOFZGhLcIxdeG09rvBoDF61zs2BKIZhxk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=JsaCO84uRT8BscJo2c6lns/pznGSArTBpkIT5YRcUdBFlgdzciI+nmHINm696peVcFhIh7qiFGqDCvv3gxQkt7uvd9PJwBFmrEWlW93xzrd9I3CrchnypoWQHH00NLa2Pk3S3Rae6kAESgYAtreNrn5T4GmlTASZAjb8JX6/+VE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=YlspaazB; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1759389390; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=1GSMR27hsPUoie6UnsgaJIavv0xUMmpLJvLfbvZzpyw=; b=YlspaazBlQh1BarHTPBqv9I27CMw6aOSV08y4uAxh7fVgcxMVuItiBdtL0JZ9pqlPNE2JS /FC02PMgw4kZ0nubHKDu1w0FeH1masPdTs1Uvaqm4asqntGhmZYdex8TZuJNFCFLWO6d57 OaHg9GwlQVODzSukM+94BLGfL+q4Acw= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-465-ehXmJ4B_NzuvAQHGcoh5Qw-1; Thu, 02 Oct 2025 03:16:27 -0400 X-MC-Unique: ehXmJ4B_NzuvAQHGcoh5Qw-1 X-Mimecast-MFC-AGG-ID: ehXmJ4B_NzuvAQHGcoh5Qw_1759389386 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-3ecdd80ea44so737843f8f.1 for ; Thu, 02 Oct 2025 00:16:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759389386; x=1759994186; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1GSMR27hsPUoie6UnsgaJIavv0xUMmpLJvLfbvZzpyw=; b=pt8Rvkpkn45IYLOka9hmrw4uGAFK4GKcAI0zTaXHda2wLzhZBAz/8GWU7xv5HKJcAd m4Sb+EhJj59IB5Zx/+Dz8cHAkSrgU4Jvs5dRnJ6btSXhT6wUkOIJwAwMEuTCMLBRPzc5 QaGbAuXoJR4PQIC7PuQcEPabwAUNZWfYVkz7jTSDgCYtwDDO//OJ7KyJ7ARGr4Oq66n1 KkhLMJdj5l/jutiWqavShoJ2+D3o9Q7SNWlv0J++rBrXiuJcgh6Uth6LZMIW2lzGkGMf w986r/06TpLOj5i8SY/GEXhcx7H/A/ywzQok7awGbJM47I8nShhJw1IapJPTRWQ1Egkq F1vQ== X-Forwarded-Encrypted: i=1; AJvYcCUzC+UKpGobBrV87CQ6Tj83hVqKUNJ2s/TZMYcrsEWjqJlCuMMBuTsWyC680rIQHQO/OYXmy7U=@vger.kernel.org X-Gm-Message-State: AOJu0YzUqoi3owGCd2xttS0Awl2YxSTZ9uMx/olAZ8BTuT8VryT+euNb WtbN1Q4rZi479e68uqyjUO395XAdxNf0abuq8RJGFtowoZmwgsPT88fSZzhw9IxtZwJUXOEPm/e oVT2K+q35I3mYjXbgSl/z3GvzK58m7p+6EfaojF4V43muDGUTpJTrVNfJkg== X-Gm-Gg: ASbGncsqgRPdSoQUkxUvWIgR5YeQG6YhTSq7LMi5cQmkFcYQUNIy4Tka6i0wP0bog1H TzovGbz2mfQXjNXTTU2PY/e6kvo7xNVNTLVTTIV8okftR04Cg2kaJ4NOEGZ/7GEuvTkdUfnDkSj 4AHwZx+haFo9qPmQL+hxzsorgpMf/RQLsioRcTz3pg6k9GiT2exxZt2Pt63v7rCHR4azGKmeeKm fDU2LQDMpGqbAuOIBvwvXLGwrWBxlHP3ROZBmxyfwfqdZA3dyFSs6mC0MLtBZdEd3QZ0oeLIa7B Xxx76nPw0fFwOppzti+WmUOGGiVvlG8qk9gh74Srzc5aQSYwkbE1XR4T/Q/HvJIDgTF5BQya1ZC 9sNjUgcrj X-Received: by 2002:a05:6000:1a86:b0:3ec:dfe5:17e8 with SMTP id ffacd0b85a97d-4255d294d2emr1524309f8f.6.1759389386164; Thu, 02 Oct 2025 00:16:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE+Q/M2OlgijeOAdFrqP6QBlh2tyKnC3lcVltauGf5917JFuF4BsL0kpGZDKPSm1P3cI2xQpQ== X-Received: by 2002:a05:6000:1a86:b0:3ec:dfe5:17e8 with SMTP id ffacd0b85a97d-4255d294d2emr1524284f8f.6.1759389385675; Thu, 02 Oct 2025 00:16:25 -0700 (PDT) Received: from [192.168.3.141] (tmo-080-144.customers.d1-online.com. [80.187.80.144]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4255d8a6e1bsm2378053f8f.8.2025.10.02.00.16.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Oct 2025 00:16:25 -0700 (PDT) Message-ID: Date: Thu, 2 Oct 2025 09:16:23 +0200 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [Patch v2] mm/huge_memory: add pmd folio to ds_queue in do_huge_zero_wp_pmd() To: Wei Yang , Lance Yang Cc: akpm@linux-foundation.org, lorenzo.stoakes@oracle.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com, Liam.Howlett@oracle.com, npache@redhat.com, ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org, wangkefeng.wang@huawei.com, linux-mm@kvack.org, stable@vger.kernel.org References: <20251002013825.20448-1-richard.weiyang@gmail.com> <20251002014604.d2ryohvtrdfn7mvf@master> <20251002031743.4anbofbyym5tlwrt@master> From: David Hildenbrand Content-Language: en-US Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9 PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk ZW5icmFuZCA8ZGF2aWRAcmVkaGF0LmNvbT7CwZoEEwEIAEQCGwMCF4ACGQEFCwkIBwICIgIG FQoJCAsCBBYCAwECHgcWIQQb2cqtc1xMOkYN/MpN3hD3AP+DWgUCaJzangUJJlgIpAAKCRBN 3hD3AP+DWhAxD/9wcL0A+2rtaAmutaKTfxhTP0b4AAp1r/eLxjrbfbCCmh4pqzBhmSX/4z11 opn2KqcOsueRF1t2ENLOWzQu3Roiny2HOU7DajqB4dm1BVMaXQya5ae2ghzlJN9SIoopTWlR 0Af3hPj5E2PYvQhlcqeoehKlBo9rROJv/rjmr2x0yOM8qeTroH/ZzNlCtJ56AsE6Tvl+r7cW 3x7/Jq5WvWeudKrhFh7/yQ7eRvHCjd9bBrZTlgAfiHmX9AnCCPRPpNGNedV9Yty2Jnxhfmbv Pw37LA/jef8zlCDyUh2KCU1xVEOWqg15o1RtTyGV1nXV2O/mfuQJud5vIgzBvHhypc3p6VZJ lEf8YmT+Ol5P7SfCs5/uGdWUYQEMqOlg6w9R4Pe8d+mk8KGvfE9/zTwGg0nRgKqlQXrWRERv cuEwQbridlPAoQHrFWtwpgYMXx2TaZ3sihcIPo9uU5eBs0rf4mOERY75SK+Ekayv2ucTfjxr Kf014py2aoRJHuvy85ee/zIyLmve5hngZTTe3Wg3TInT9UTFzTPhItam6dZ1xqdTGHZYGU0O otRHcwLGt470grdiob6PfVTXoHlBvkWRadMhSuG4RORCDpq89vu5QralFNIf3EysNohoFy2A LYg2/D53xbU/aa4DDzBb5b1Rkg/udO1gZocVQWrDh6I2K3+cCs7BTQRVy5+RARAA59fefSDR 9nMGCb9LbMX+TFAoIQo/wgP5XPyzLYakO+94GrgfZjfhdaxPXMsl2+o8jhp/hlIzG56taNdt VZtPp3ih1AgbR8rHgXw1xwOpuAd5lE1qNd54ndHuADO9a9A0vPimIes78Hi1/yy+ZEEvRkHk /kDa6F3AtTc1m4rbbOk2fiKzzsE9YXweFjQvl9p+AMw6qd/iC4lUk9g0+FQXNdRs+o4o6Qvy iOQJfGQ4UcBuOy1IrkJrd8qq5jet1fcM2j4QvsW8CLDWZS1L7kZ5gT5EycMKxUWb8LuRjxzZ 3QY1aQH2kkzn6acigU3HLtgFyV1gBNV44ehjgvJpRY2cC8VhanTx0dZ9mj1YKIky5N+C0f21 zvntBqcxV0+3p8MrxRRcgEtDZNav+xAoT3G0W4SahAaUTWXpsZoOecwtxi74CyneQNPTDjNg azHmvpdBVEfj7k3p4dmJp5i0U66Onmf6mMFpArvBRSMOKU9DlAzMi4IvhiNWjKVaIE2Se9BY FdKVAJaZq85P2y20ZBd08ILnKcj7XKZkLU5FkoA0udEBvQ0f9QLNyyy3DZMCQWcwRuj1m73D sq8DEFBdZ5eEkj1dCyx+t/ga6x2rHyc8Sl86oK1tvAkwBNsfKou3v+jP/l14a7DGBvrmlYjO 59o3t6inu6H7pt7OL6u6BQj7DoMAEQEAAcLBfAQYAQgAJgIbDBYhBBvZyq1zXEw6Rg38yk3e EPcA/4NaBQJonNqrBQkmWAihAAoJEE3eEPcA/4NaKtMQALAJ8PzprBEXbXcEXwDKQu+P/vts IfUb1UNMfMV76BicGa5NCZnJNQASDP/+bFg6O3gx5NbhHHPeaWz/VxlOmYHokHodOvtL0WCC 8A5PEP8tOk6029Z+J+xUcMrJClNVFpzVvOpb1lCbhjwAV465Hy+NUSbbUiRxdzNQtLtgZzOV Zw7jxUCs4UUZLQTCuBpFgb15bBxYZ/BL9MbzxPxvfUQIPbnzQMcqtpUs21CMK2PdfCh5c4gS sDci6D5/ZIBw94UQWmGpM/O1ilGXde2ZzzGYl64glmccD8e87OnEgKnH3FbnJnT4iJchtSvx yJNi1+t0+qDti4m88+/9IuPqCKb6Stl+s2dnLtJNrjXBGJtsQG/sRpqsJz5x1/2nPJSRMsx9 5YfqbdrJSOFXDzZ8/r82HgQEtUvlSXNaXCa95ez0UkOG7+bDm2b3s0XahBQeLVCH0mw3RAQg r7xDAYKIrAwfHHmMTnBQDPJwVqxJjVNr7yBic4yfzVWGCGNE4DnOW0vcIeoyhy9vnIa3w1uZ 3iyY2Nsd7JxfKu1PRhCGwXzRw5TlfEsoRI7V9A8isUCoqE2Dzh3FvYHVeX4Us+bRL/oqareJ CIFqgYMyvHj7Q06kTKmauOe4Nf0l0qEkIuIzfoLJ3qr5UyXc2hLtWyT9Ir+lYlX9efqh7mOY qIws/H2t In-Reply-To: <20251002031743.4anbofbyym5tlwrt@master> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-DKIM: signer='redhat.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -0.0 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-0.0 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.199.223 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.199.223 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.199.223 listed in sa-trusted.bondedsender.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.5 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: 0 On 02.10.25 05:17, Wei Yang wrote: > On Thu, Oct 02, 2025 at 10:31:53AM +0800, Lance Yang wrote: >> >> >> On 2025/10/2 09:46, Wei Yang wrote: >>> On Thu, Oct 02, 2025 at 01:38:25AM +0000, Wei Yang wrote: >>>> We add pmd folio into ds_queue on the first page fault in >>>> __do_huge_pmd_anonymous_page(), so that we can split it in case of >>>> memory pressure. This should be the same for a pmd folio during wp >>>> page fault. >>>> >>>> Commit 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") miss >>>> to add it to ds_queue, which means system may not reclaim enough memory >>>> in case of memory pressure even the pmd folio is under used. >>>> >>>> Move deferred_split_folio() into map_anon_folio_pmd() to make the pmd >>>> folio installation consistent. >>>> >>> >>> Since we move deferred_split_folio() into map_anon_folio_pmd(), I am thinking >>> about whether we can consolidate the process in collapse_huge_page(). >>> >>> Use map_anon_folio_pmd() in collapse_huge_page(), but skip those statistic >>> adjustment. >> >> Yeah, that's a good idea :) >> >> We could add a simple bool is_fault parameter to map_anon_folio_pmd() >> to control the statistics. >> >> The fault paths would call it with true, and the collapse paths could >> then call it with false. >> >> Something like this: >> >> ``` >> diff --git a/mm/huge_memory.c b/mm/huge_memory.c >> index 1b81680b4225..9924180a4a56 100644 >> --- a/mm/huge_memory.c >> +++ b/mm/huge_memory.c >> @@ -1218,7 +1218,7 @@ static struct folio *vma_alloc_anon_folio_pmd(struct >> vm_area_struct *vma, >> } >> >> static void map_anon_folio_pmd(struct folio *folio, pmd_t *pmd, >> - struct vm_area_struct *vma, unsigned long haddr) >> + struct vm_area_struct *vma, unsigned long haddr, bool is_fault) >> { >> pmd_t entry; >> >> @@ -1228,10 +1228,15 @@ static void map_anon_folio_pmd(struct folio *folio, >> pmd_t *pmd, >> folio_add_lru_vma(folio, vma); >> set_pmd_at(vma->vm_mm, haddr, pmd, entry); >> update_mmu_cache_pmd(vma, haddr, pmd); >> - add_mm_counter(vma->vm_mm, MM_ANONPAGES, HPAGE_PMD_NR); >> - count_vm_event(THP_FAULT_ALLOC); >> - count_mthp_stat(HPAGE_PMD_ORDER, MTHP_STAT_ANON_FAULT_ALLOC); >> - count_memcg_event_mm(vma->vm_mm, THP_FAULT_ALLOC); >> + >> + if (is_fault) { >> + add_mm_counter(vma->vm_mm, MM_ANONPAGES, HPAGE_PMD_NR); >> + count_vm_event(THP_FAULT_ALLOC); >> + count_mthp_stat(HPAGE_PMD_ORDER, MTHP_STAT_ANON_FAULT_ALLOC); >> + count_memcg_event_mm(vma->vm_mm, THP_FAULT_ALLOC); >> + } >> + >> + deferred_split_folio(folio, false); >> } >> >> static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf) >> diff --git a/mm/khugepaged.c b/mm/khugepaged.c >> index d0957648db19..2eddd5a60e48 100644 >> --- a/mm/khugepaged.c >> +++ b/mm/khugepaged.c >> @@ -1227,17 +1227,10 @@ static int collapse_huge_page(struct mm_struct *mm, >> unsigned long address, >> __folio_mark_uptodate(folio); >> pgtable = pmd_pgtable(_pmd); >> >> - _pmd = folio_mk_pmd(folio, vma->vm_page_prot); >> - _pmd = maybe_pmd_mkwrite(pmd_mkdirty(_pmd), vma); >> - >> spin_lock(pmd_ptl); >> BUG_ON(!pmd_none(*pmd)); >> - folio_add_new_anon_rmap(folio, vma, address, RMAP_EXCLUSIVE); >> - folio_add_lru_vma(folio, vma); >> pgtable_trans_huge_deposit(mm, pmd, pgtable); >> - set_pmd_at(mm, address, pmd, _pmd); >> - update_mmu_cache_pmd(vma, address, pmd); >> - deferred_split_folio(folio, false); >> + map_anon_folio_pmd(folio, pmd, vma, address, false); >> spin_unlock(pmd_ptl); >> >> folio = NULL; >> ``` >> >> Untested, though. >> > > This is the same as I thought. > > Will prepare a patch for it. Let's do that as an add-on patch, though. -- Cheers David / dhildenb From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id mFi5Cocm3mixqDIAYBR5ng (envelope-from ) for ; Thu, 02 Oct 2025 07:15:19 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Thu, 02 Oct 2025 07:15:19 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v4DX4-0000000EUZT-3V2Y for hi@josie.lol; Thu, 02 Oct 2025 07:15:19 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9AEB319259F0 for ; Thu, 2 Oct 2025 07:15:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D68D2882B7; Thu, 2 Oct 2025 07:15:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KoANV70f" X-Original-To: stable@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 77878136351 for ; Thu, 2 Oct 2025 07:15:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759389309; cv=none; b=Bpa+FjTREb/1E0Xs0MLALtvgkk5LZ2mX5RkDUDHEeOU03OF2ItkaUO5tT3uMZKkp2oJbLeaJlu6VRqVlWj6iMgyARJEWBuAfY0iXu94XzySaDxKn36EHztJrH0M1P3DnqqHLO3tO8w1VQL5XBu3iFNR5m+yYoFG6IY5w6H+TrEw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759389309; c=relaxed/simple; bh=r1X7gjQp3q7PttXv0xXz9fxuLfZlwKxlgl236AtZkrM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=pxsckmnVCXJQ4rkcGYRmtD++iRngrybtJEzxjgfn7mGXgSC2n4p5VDHA5KwtqyyWqtaprw/3cFSWXWeJnjj+idhyPKe3iOtLRsS+6onoD0W7yA9/9J2++KJdJjpjsSFDs8vueS+nuqND4cgjZOmODuLihT16+/bVJK34ua++pbo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=KoANV70f; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1759389305; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=W5Ac778AheL7NpJNRSTMLehCP0Q4ZljNAYBSiaX38qE=; b=KoANV70fVlX0yGCYJMNk+CZ0oHkTjwGhQm4eNlau0xP1wH4c+y7VKExrOsWUH29M8iWx3H 0OQVgE2scgu1sOAiVlRx5S1fhE0J+xipuR+sofujqPFCEQNKCrQiSc0OR84+00W+b8aZM4 ZZ1pTMUOwO6DFns2e3gQ2VUBxN54kB0= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-214-SbXHb4-9N-qa6DmG2P0o8A-1; Thu, 02 Oct 2025 03:15:04 -0400 X-MC-Unique: SbXHb4-9N-qa6DmG2P0o8A-1 X-Mimecast-MFC-AGG-ID: SbXHb4-9N-qa6DmG2P0o8A_1759389303 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-46e2c11b94cso2742575e9.3 for ; Thu, 02 Oct 2025 00:15:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759389303; x=1759994103; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=W5Ac778AheL7NpJNRSTMLehCP0Q4ZljNAYBSiaX38qE=; b=T6tZdsJ5AVA/3Xovr3F1/fIMOSDsn8OsRQ0lHkTcXF9cQMRlOAInowpkT925lxVwm3 73rGat10Bz92mtKpC4pQzV5IbEVSJnANdI5YSfF0Jx0ymsrpjOZANduaUwTGZRiVr25Q AnOd0ihOQlSdVA8sLhdP2/ruNg4H8L+Swv/+XH7dnHb6clVrD9GScLlKqkoatrniX1Ef o8lHzPxmpxxNqAnvMJbncJd2fsGdCUFidGVnZTP7Cp05cOcSQNiUm3jE1aIh3fCwpXho RqL88BHLAqP+FM7hIX7MyT8Ek7lEyvv1k/m64HDv1sbB5XFctI+NqgDXKZj6JkwbLURF VVmg== X-Forwarded-Encrypted: i=1; AJvYcCV2Eb3TY3wlHTdDK1kHs/Ub4HbJY7RCC+uM/SMpXyMuY0wWT1RBzAf4cOkKCGjn1qms3CdUqbM=@vger.kernel.org X-Gm-Message-State: AOJu0Yyc+BkKMjOohrC3Da9RAvh+JyFcTklQoMqvo/LprJNA7Syn02If AVLsP7UdemvbYLplLYF7Mb5c9+V9OBa22xc/xwP4lG+1NexuGA+oWCfkXr0BOkYbCs62cBrjmiG mMJ5moWPxr1N5IKEZa5hfz4rrFPC725KNh0l7pXV1SihzLUfiqHzIh0W4pw== X-Gm-Gg: ASbGncusV0tqoRdnnp8AeFXIuisCc2VgRb7b/A6pNGVV3wbOB8u+563xRZZPrXPyMfn M1akK3MZhLvIfGPn9UHRNjGy7LS8jTohCU6hk4mBQTBM7qMw4zP9h8XOaPUU+ufdYaURLLuI/zc ei8TpW14nZK96llPhJuJxX8t2VSbGyeO2wBuvKmn+wEaxb/M8u33FksJWyHWL82I7OKF+R2hPhu pVFCH312vCnJ2EaCgTwGj5kQITgMOqvL5vDfS/2isYLW7ekYD8HJ32aITMUA5u3XAcsLs6nMQj5 6n/KJ+hvS603CzGMfW9Lf3pc4zIm/rneZtafseYJW2GVeGEpoykqwbYPy+TJ4F24B+pTzYVmCzl d0MOny5tk X-Received: by 2002:a05:600c:1c95:b0:46e:6af4:ed83 with SMTP id 5b1f17b1804b1-46e6af4efffmr7952625e9.23.1759389302749; Thu, 02 Oct 2025 00:15:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE8ldnTz2JbgHQGaCW5pgTHhvepIXyjeIE3ouCdne2DyJMLKZaH3KmUT6eErXmw4mzjZSH9zA== X-Received: by 2002:a05:600c:1c95:b0:46e:6af4:ed83 with SMTP id 5b1f17b1804b1-46e6af4efffmr7952405e9.23.1759389302317; Thu, 02 Oct 2025 00:15:02 -0700 (PDT) Received: from [192.168.3.141] (tmo-080-144.customers.d1-online.com. [80.187.80.144]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-46e6917a279sm23052245e9.4.2025.10.02.00.15.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Oct 2025 00:15:01 -0700 (PDT) Message-ID: <4cd8bfef-c726-4097-a694-1781898c1d26@redhat.com> Date: Thu, 2 Oct 2025 09:14:59 +0200 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [Patch v2] mm/huge_memory: add pmd folio to ds_queue in do_huge_zero_wp_pmd() To: Wei Yang , akpm@linux-foundation.org, lorenzo.stoakes@oracle.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com, Liam.Howlett@oracle.com, npache@redhat.com, ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org, lance.yang@linux.dev, wangkefeng.wang@huawei.com Cc: linux-mm@kvack.org, stable@vger.kernel.org References: <20251002013825.20448-1-richard.weiyang@gmail.com> From: David Hildenbrand Content-Language: en-US Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9 PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk ZW5icmFuZCA8ZGF2aWRAcmVkaGF0LmNvbT7CwZoEEwEIAEQCGwMCF4ACGQEFCwkIBwICIgIG FQoJCAsCBBYCAwECHgcWIQQb2cqtc1xMOkYN/MpN3hD3AP+DWgUCaJzangUJJlgIpAAKCRBN 3hD3AP+DWhAxD/9wcL0A+2rtaAmutaKTfxhTP0b4AAp1r/eLxjrbfbCCmh4pqzBhmSX/4z11 opn2KqcOsueRF1t2ENLOWzQu3Roiny2HOU7DajqB4dm1BVMaXQya5ae2ghzlJN9SIoopTWlR 0Af3hPj5E2PYvQhlcqeoehKlBo9rROJv/rjmr2x0yOM8qeTroH/ZzNlCtJ56AsE6Tvl+r7cW 3x7/Jq5WvWeudKrhFh7/yQ7eRvHCjd9bBrZTlgAfiHmX9AnCCPRPpNGNedV9Yty2Jnxhfmbv Pw37LA/jef8zlCDyUh2KCU1xVEOWqg15o1RtTyGV1nXV2O/mfuQJud5vIgzBvHhypc3p6VZJ lEf8YmT+Ol5P7SfCs5/uGdWUYQEMqOlg6w9R4Pe8d+mk8KGvfE9/zTwGg0nRgKqlQXrWRERv cuEwQbridlPAoQHrFWtwpgYMXx2TaZ3sihcIPo9uU5eBs0rf4mOERY75SK+Ekayv2ucTfjxr Kf014py2aoRJHuvy85ee/zIyLmve5hngZTTe3Wg3TInT9UTFzTPhItam6dZ1xqdTGHZYGU0O otRHcwLGt470grdiob6PfVTXoHlBvkWRadMhSuG4RORCDpq89vu5QralFNIf3EysNohoFy2A LYg2/D53xbU/aa4DDzBb5b1Rkg/udO1gZocVQWrDh6I2K3+cCs7BTQRVy5+RARAA59fefSDR 9nMGCb9LbMX+TFAoIQo/wgP5XPyzLYakO+94GrgfZjfhdaxPXMsl2+o8jhp/hlIzG56taNdt VZtPp3ih1AgbR8rHgXw1xwOpuAd5lE1qNd54ndHuADO9a9A0vPimIes78Hi1/yy+ZEEvRkHk /kDa6F3AtTc1m4rbbOk2fiKzzsE9YXweFjQvl9p+AMw6qd/iC4lUk9g0+FQXNdRs+o4o6Qvy iOQJfGQ4UcBuOy1IrkJrd8qq5jet1fcM2j4QvsW8CLDWZS1L7kZ5gT5EycMKxUWb8LuRjxzZ 3QY1aQH2kkzn6acigU3HLtgFyV1gBNV44ehjgvJpRY2cC8VhanTx0dZ9mj1YKIky5N+C0f21 zvntBqcxV0+3p8MrxRRcgEtDZNav+xAoT3G0W4SahAaUTWXpsZoOecwtxi74CyneQNPTDjNg azHmvpdBVEfj7k3p4dmJp5i0U66Onmf6mMFpArvBRSMOKU9DlAzMi4IvhiNWjKVaIE2Se9BY FdKVAJaZq85P2y20ZBd08ILnKcj7XKZkLU5FkoA0udEBvQ0f9QLNyyy3DZMCQWcwRuj1m73D sq8DEFBdZ5eEkj1dCyx+t/ga6x2rHyc8Sl86oK1tvAkwBNsfKou3v+jP/l14a7DGBvrmlYjO 59o3t6inu6H7pt7OL6u6BQj7DoMAEQEAAcLBfAQYAQgAJgIbDBYhBBvZyq1zXEw6Rg38yk3e EPcA/4NaBQJonNqrBQkmWAihAAoJEE3eEPcA/4NaKtMQALAJ8PzprBEXbXcEXwDKQu+P/vts IfUb1UNMfMV76BicGa5NCZnJNQASDP/+bFg6O3gx5NbhHHPeaWz/VxlOmYHokHodOvtL0WCC 8A5PEP8tOk6029Z+J+xUcMrJClNVFpzVvOpb1lCbhjwAV465Hy+NUSbbUiRxdzNQtLtgZzOV Zw7jxUCs4UUZLQTCuBpFgb15bBxYZ/BL9MbzxPxvfUQIPbnzQMcqtpUs21CMK2PdfCh5c4gS sDci6D5/ZIBw94UQWmGpM/O1ilGXde2ZzzGYl64glmccD8e87OnEgKnH3FbnJnT4iJchtSvx yJNi1+t0+qDti4m88+/9IuPqCKb6Stl+s2dnLtJNrjXBGJtsQG/sRpqsJz5x1/2nPJSRMsx9 5YfqbdrJSOFXDzZ8/r82HgQEtUvlSXNaXCa95ez0UkOG7+bDm2b3s0XahBQeLVCH0mw3RAQg r7xDAYKIrAwfHHmMTnBQDPJwVqxJjVNr7yBic4yfzVWGCGNE4DnOW0vcIeoyhy9vnIa3w1uZ 3iyY2Nsd7JxfKu1PRhCGwXzRw5TlfEsoRI7V9A8isUCoqE2Dzh3FvYHVeX4Us+bRL/oqareJ CIFqgYMyvHj7Q06kTKmauOe4Nf0l0qEkIuIzfoLJ3qr5UyXc2hLtWyT9Ir+lYlX9efqh7mOY qIws/H2t In-Reply-To: <20251002013825.20448-1-richard.weiyang@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-DKIM: signer='redhat.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -2.3 (--) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-2.3 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.80.249 listed in bl.score.senderscore.com] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [147.75.80.249 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.80.249 listed in sa-trusted.bondedsender.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.5 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -22 On 02.10.25 03:38, Wei Yang wrote: > We add pmd folio into ds_queue on the first page fault in > __do_huge_pmd_anonymous_page(), so that we can split it in case of > memory pressure. This should be the same for a pmd folio during wp > page fault. > > Commit 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") miss > to add it to ds_queue, which means system may not reclaim enough memory > in case of memory pressure even the pmd folio is under used. > > Move deferred_split_folio() into map_anon_folio_pmd() to make the pmd > folio installation consistent. > > Fixes: 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") > Signed-off-by: Wei Yang > Cc: David Hildenbrand > Cc: Lance Yang > Cc: Dev Jain > Cc: Acked-by: David Hildenbrand -- Cheers David / dhildenb From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id aCF5DODu3WioexIAYBR5ng (envelope-from ) for ; Thu, 02 Oct 2025 03:17:52 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Thu, 02 Oct 2025 03:17:52 +0000 Received: from ny.mirrors.kernel.org ([147.75.199.223]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v49pH-00000006sbc-41Ar for hi@josie.lol; Thu, 02 Oct 2025 03:17:52 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 133FF16BF61 for ; Thu, 2 Oct 2025 03:17:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 981D3BA34; Thu, 2 Oct 2025 03:17:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GlId8bCp" X-Original-To: stable@vger.kernel.org Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE2AA34BA50 for ; Thu, 2 Oct 2025 03:17:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759375068; cv=none; b=MvPnVNv84m90QPeoumAj+/ijZUgs4u1J4oZXN9XWA9KiEZT/6i66rVFUTIl3rbvUBOXKyrI74DMKjy/IJDUo43X/Acqppm9d1kyIPiwPXnFbnQi4RK5yGFbFLxNTYJfn3LWXFqKkzn9o/27ap5D7Onh+uNCzYeK6twCuoikf5yA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759375068; c=relaxed/simple; bh=bma062V6Yy0cp8342vbMIqP2vsCbmtrUyHVbtgqDiq8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WyUQTMP0l+rlDlyJRQOX54M3Xg+ASmq0BTueW50F7vYNRmhfys1taTbUfVib7CkkvlIZflwg3PpsAGaUXyFtjHT2mEoX6OnPb8DU2cwKdh6H7uPRmQv2wJNFHD23GIMRpvrE1xSP4qcg5WZkIzQM552FY4+VAnzV5VuBdqPLcqw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GlId8bCp; arc=none smtp.client-ip=209.85.218.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-afcb7a16441so99189166b.2 for ; Wed, 01 Oct 2025 20:17:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759375065; x=1759979865; darn=vger.kernel.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=ukIjXlnpeq1rHbLV2IaXOhdHQVb6iKLF8mmZ545G2bI=; b=GlId8bCppnHGI4pzyyIIpFrSAilYdQkHKSHdQzHm3YX+/r0rkjiPL+HSh2AJ9sP99v KqvH9jxF5TZ+foGGlpGGnyaRwnGX49JhvOurzynEkn3x1GRGFuuONO0qp4KZny9lit0O bm3OP44TeHc3ayMiB8bsBG7csg2l42W/4mY7SwCb4kQlVdYiKBuKmf8dyW+XzPDZGSBN dtHogxfgL0bvR2N4IwQ5yK5eIO5gjF27j+4YsldzJEerCiEdXlmoGpOL7kI2XunnaPUE Sgf6WHX1I7vkX6IsGH8R0QzydOWX2mrMg9DZT9hT12DlUbHDCLk3QoMcH1EYLorkT9Gq rOZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759375065; x=1759979865; h=user-agent:in-reply-to:content-disposition:mime-version:references :reply-to:message-id:subject:cc:to:from:date:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ukIjXlnpeq1rHbLV2IaXOhdHQVb6iKLF8mmZ545G2bI=; b=r1w58Xpmah4MHM7cwK7D6KRgHmG7/WWLK9Bpl9EpLtfKuKb7JCDDQO//kPbIByKsNB WPiAqjx4CScnlI2BJZKwi8622AyBmfdcfK21FQTsTWqEAKyUxYuNw+Pmb6i6j8KfjE77 S/bsGfLwU1wAwKIlatL97vK37jHYKmuqAsothbc+15ju01HKnhwcGl4d83lIiyekKu2E Om/WjSVEpPqkvsgltajevlrnLVoBmIbNFU8niFdDtvKZ1kOxo9HiV9aqyjBC5P5G3TuQ KiYosHxbFuGGNwq7z7JFathT2IOvfuBJBrf9Gd5RIj7MnmHikDrY3ogF/WjjqAZO/6hh xzHw== X-Forwarded-Encrypted: i=1; AJvYcCVsm9oAWwWSEyNg+bB6jSo5EE1BjIPRYjpV+QYtMNJupl+rDvu0Vg0h4xxPQ1izcPlzqG9OhVU=@vger.kernel.org X-Gm-Message-State: AOJu0YyyMffJI522g+T3C//IsJqxEnMvYvrujU4hV0o/0XYH7RN8066/ xGwyXgAWcV0YJsXMJWg6O5KtsQToP50nGS2oUbl770566OiA6WIIQRiT X-Gm-Gg: ASbGncvH3bLizwu0zuBMoFDh+G6/3aOml9BGWPzp8RNHVGQ9eBYng5p6NuQxHcEr+yD l10cwO/u8rC25Gl16YCENTg2p+gZv38R/tMzoCtCeCi0lxC15wQfsO0wo+AMz/CF75gSn0VEMFB zHSOTQuVxh6Av3RdYcGQbPZNt1Exc8TZNdZa+JYaCb8fRGDfvBqoq+5aLkLjeZIy+0VQpgeKTXx 9JX9iXE+lkUJgTf4REwbPGaf78/MeVerAIjt+gwqFsi+8Ah1P9KQ60xX/jYAm3hkubDqlpDjeNy y98qpuJIlWn4wR4jJuQjulXKA6tTGCT+MRRPnj5oyoqhB9fJu/cc1TY5BBNXC3DQQDKUw/kvnwO uI+zcn906mgOnsTj1GVsoQnzQGsDW9bikJ/84Bh/zHAZx3kuTiyJCaKjvyXFS X-Google-Smtp-Source: AGHT+IGz5qdn7Z8WqPdcaSzQRnRcwjhB2iTUbVl5Nl2cC+78S079TdI9YWxGEdwKvxX3OhBhqheR9g== X-Received: by 2002:a17:906:7314:b0:b3f:b7ca:26c5 with SMTP id a640c23a62f3a-b46e68103bbmr711840066b.59.1759375064743; Wed, 01 Oct 2025 20:17:44 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b486a173b4csm101736166b.86.2025.10.01.20.17.44 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Oct 2025 20:17:44 -0700 (PDT) Date: Thu, 2 Oct 2025 03:17:43 +0000 From: Wei Yang To: Lance Yang Cc: Wei Yang , akpm@linux-foundation.org, david@redhat.com, lorenzo.stoakes@oracle.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com, Liam.Howlett@oracle.com, npache@redhat.com, ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org, wangkefeng.wang@huawei.com, linux-mm@kvack.org, stable@vger.kernel.org Subject: Re: [Patch v2] mm/huge_memory: add pmd folio to ds_queue in do_huge_zero_wp_pmd() Message-ID: <20251002031743.4anbofbyym5tlwrt@master> Reply-To: Wei Yang References: <20251002013825.20448-1-richard.weiyang@gmail.com> <20251002014604.d2ryohvtrdfn7mvf@master> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.199.223 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.199.223 listed in bl.score.senderscore.com] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [richard.weiyang[at]gmail.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On Thu, Oct 02, 2025 at 10:31:53AM +0800, Lance Yang wrote: > > >On 2025/10/2 09:46, Wei Yang wrote: >> On Thu, Oct 02, 2025 at 01:38:25AM +0000, Wei Yang wrote: >> > We add pmd folio into ds_queue on the first page fault in >> > __do_huge_pmd_anonymous_page(), so that we can split it in case of >> > memory pressure. This should be the same for a pmd folio during wp >> > page fault. >> > >> > Commit 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") miss >> > to add it to ds_queue, which means system may not reclaim enough memory >> > in case of memory pressure even the pmd folio is under used. >> > >> > Move deferred_split_folio() into map_anon_folio_pmd() to make the pmd >> > folio installation consistent. >> > >> >> Since we move deferred_split_folio() into map_anon_folio_pmd(), I am thinking >> about whether we can consolidate the process in collapse_huge_page(). >> >> Use map_anon_folio_pmd() in collapse_huge_page(), but skip those statistic >> adjustment. > >Yeah, that's a good idea :) > >We could add a simple bool is_fault parameter to map_anon_folio_pmd() >to control the statistics. > >The fault paths would call it with true, and the collapse paths could >then call it with false. > >Something like this: > >``` >diff --git a/mm/huge_memory.c b/mm/huge_memory.c >index 1b81680b4225..9924180a4a56 100644 >--- a/mm/huge_memory.c >+++ b/mm/huge_memory.c >@@ -1218,7 +1218,7 @@ static struct folio *vma_alloc_anon_folio_pmd(struct >vm_area_struct *vma, > } > > static void map_anon_folio_pmd(struct folio *folio, pmd_t *pmd, >- struct vm_area_struct *vma, unsigned long haddr) >+ struct vm_area_struct *vma, unsigned long haddr, bool is_fault) > { > pmd_t entry; > >@@ -1228,10 +1228,15 @@ static void map_anon_folio_pmd(struct folio *folio, >pmd_t *pmd, > folio_add_lru_vma(folio, vma); > set_pmd_at(vma->vm_mm, haddr, pmd, entry); > update_mmu_cache_pmd(vma, haddr, pmd); >- add_mm_counter(vma->vm_mm, MM_ANONPAGES, HPAGE_PMD_NR); >- count_vm_event(THP_FAULT_ALLOC); >- count_mthp_stat(HPAGE_PMD_ORDER, MTHP_STAT_ANON_FAULT_ALLOC); >- count_memcg_event_mm(vma->vm_mm, THP_FAULT_ALLOC); >+ >+ if (is_fault) { >+ add_mm_counter(vma->vm_mm, MM_ANONPAGES, HPAGE_PMD_NR); >+ count_vm_event(THP_FAULT_ALLOC); >+ count_mthp_stat(HPAGE_PMD_ORDER, MTHP_STAT_ANON_FAULT_ALLOC); >+ count_memcg_event_mm(vma->vm_mm, THP_FAULT_ALLOC); >+ } >+ >+ deferred_split_folio(folio, false); > } > > static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf) >diff --git a/mm/khugepaged.c b/mm/khugepaged.c >index d0957648db19..2eddd5a60e48 100644 >--- a/mm/khugepaged.c >+++ b/mm/khugepaged.c >@@ -1227,17 +1227,10 @@ static int collapse_huge_page(struct mm_struct *mm, >unsigned long address, > __folio_mark_uptodate(folio); > pgtable = pmd_pgtable(_pmd); > >- _pmd = folio_mk_pmd(folio, vma->vm_page_prot); >- _pmd = maybe_pmd_mkwrite(pmd_mkdirty(_pmd), vma); >- > spin_lock(pmd_ptl); > BUG_ON(!pmd_none(*pmd)); >- folio_add_new_anon_rmap(folio, vma, address, RMAP_EXCLUSIVE); >- folio_add_lru_vma(folio, vma); > pgtable_trans_huge_deposit(mm, pmd, pgtable); >- set_pmd_at(mm, address, pmd, _pmd); >- update_mmu_cache_pmd(vma, address, pmd); >- deferred_split_folio(folio, false); >+ map_anon_folio_pmd(folio, pmd, vma, address, false); > spin_unlock(pmd_ptl); > > folio = NULL; >``` > >Untested, though. > This is the same as I thought. Will prepare a patch for it. -- Wei Yang Help you, Help me From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id QDKTIjzk3WiDBhAAYBR5ng (envelope-from ) for ; Thu, 02 Oct 2025 02:32:28 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Thu, 02 Oct 2025 02:32:28 +0000 Received: from sy.mirrors.kernel.org ([147.75.48.161]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v497L-00000005T0q-3lqw for hi@josie.lol; Thu, 02 Oct 2025 02:32:28 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 3AF367B4324 for ; Thu, 2 Oct 2025 02:30:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DFB4D283FEE; Thu, 2 Oct 2025 02:32:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="CbbQ1EZo" X-Original-To: stable@vger.kernel.org Received: from out-187.mta1.migadu.com (out-187.mta1.migadu.com [95.215.58.187]) (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 32629280017 for ; Thu, 2 Oct 2025 02:32:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759372341; cv=none; b=n5tVCDr16jA/ycL3C75tjpUxJb9Fmo9csJXRjcsZybZX62lfjUdp2oeF3b5T6SK9FI16+t0GjMF8a1myhRXWLVHdNp2X6dAi7uOWOzzunol3zsoEIbNJ2cec6LrAqdGdFJe79MNnNpiFAs20a9LdhMXWdtQ/9ilIO7yIWpLc8cU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759372341; c=relaxed/simple; bh=HGgVtb3V83t4F/CK2lJUH9Sspl4Iot4SNTKE25bDVd8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=EAV0mGO0m6i1yr/vVJK+dFWQS8r05IO1/cIo46d8jJb4QG0tKeoLqNIlnkaINkv4RkQN8ABExOJl3dcjzVINwIcdXfHk3Bo6DikbRjzlPp3kHPDIIru/zCFR8VEsDJ575b3SCMv3w/CFpp4TVEhJI4+RrNOk6AzAId5o/xwEpU0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=CbbQ1EZo; arc=none smtp.client-ip=95.215.58.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1759372337; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0BIRTtLPf+QDVfO6C0pMRdsH/qN18OkH5csEBfkbiN8=; b=CbbQ1EZoL/G2TucCvc8KETWSTYQyFgE5iafViFJfAYCzTyATKovd/hMHVu2UAuXuBaDCRr e4sJoy7tfLV9CcMG/lYjnCLFhqOC/L10/3E3qUcVx4tlOTsRrpnmeDMf7XplYjHKakdTmd uyzlHETjN+ck6aSgEOXajL23OYIpJio= Date: Thu, 2 Oct 2025 10:31:53 +0800 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [Patch v2] mm/huge_memory: add pmd folio to ds_queue in do_huge_zero_wp_pmd() Content-Language: en-US To: Wei Yang Cc: akpm@linux-foundation.org, david@redhat.com, lorenzo.stoakes@oracle.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com, Liam.Howlett@oracle.com, npache@redhat.com, ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org, wangkefeng.wang@huawei.com, linux-mm@kvack.org, stable@vger.kernel.org References: <20251002013825.20448-1-richard.weiyang@gmail.com> <20251002014604.d2ryohvtrdfn7mvf@master> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Lance Yang In-Reply-To: <20251002014604.d2ryohvtrdfn7mvf@master> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-DKIM: signer='linux.dev' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.48.161 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.48.161 listed in bl.score.senderscore.com] 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linux.dev] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [147.75.48.161 listed in list.dnswl.org] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: -18 On 2025/10/2 09:46, Wei Yang wrote: > On Thu, Oct 02, 2025 at 01:38:25AM +0000, Wei Yang wrote: >> We add pmd folio into ds_queue on the first page fault in >> __do_huge_pmd_anonymous_page(), so that we can split it in case of >> memory pressure. This should be the same for a pmd folio during wp >> page fault. >> >> Commit 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") miss >> to add it to ds_queue, which means system may not reclaim enough memory >> in case of memory pressure even the pmd folio is under used. >> >> Move deferred_split_folio() into map_anon_folio_pmd() to make the pmd >> folio installation consistent. >> > > Since we move deferred_split_folio() into map_anon_folio_pmd(), I am thinking > about whether we can consolidate the process in collapse_huge_page(). > > Use map_anon_folio_pmd() in collapse_huge_page(), but skip those statistic > adjustment. Yeah, that's a good idea :) We could add a simple bool is_fault parameter to map_anon_folio_pmd() to control the statistics. The fault paths would call it with true, and the collapse paths could then call it with false. Something like this: ``` diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 1b81680b4225..9924180a4a56 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1218,7 +1218,7 @@ static struct folio *vma_alloc_anon_folio_pmd(struct vm_area_struct *vma, } static void map_anon_folio_pmd(struct folio *folio, pmd_t *pmd, - struct vm_area_struct *vma, unsigned long haddr) + struct vm_area_struct *vma, unsigned long haddr, bool is_fault) { pmd_t entry; @@ -1228,10 +1228,15 @@ static void map_anon_folio_pmd(struct folio *folio, pmd_t *pmd, folio_add_lru_vma(folio, vma); set_pmd_at(vma->vm_mm, haddr, pmd, entry); update_mmu_cache_pmd(vma, haddr, pmd); - add_mm_counter(vma->vm_mm, MM_ANONPAGES, HPAGE_PMD_NR); - count_vm_event(THP_FAULT_ALLOC); - count_mthp_stat(HPAGE_PMD_ORDER, MTHP_STAT_ANON_FAULT_ALLOC); - count_memcg_event_mm(vma->vm_mm, THP_FAULT_ALLOC); + + if (is_fault) { + add_mm_counter(vma->vm_mm, MM_ANONPAGES, HPAGE_PMD_NR); + count_vm_event(THP_FAULT_ALLOC); + count_mthp_stat(HPAGE_PMD_ORDER, MTHP_STAT_ANON_FAULT_ALLOC); + count_memcg_event_mm(vma->vm_mm, THP_FAULT_ALLOC); + } + + deferred_split_folio(folio, false); } static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index d0957648db19..2eddd5a60e48 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1227,17 +1227,10 @@ static int collapse_huge_page(struct mm_struct *mm, unsigned long address, __folio_mark_uptodate(folio); pgtable = pmd_pgtable(_pmd); - _pmd = folio_mk_pmd(folio, vma->vm_page_prot); - _pmd = maybe_pmd_mkwrite(pmd_mkdirty(_pmd), vma); - spin_lock(pmd_ptl); BUG_ON(!pmd_none(*pmd)); - folio_add_new_anon_rmap(folio, vma, address, RMAP_EXCLUSIVE); - folio_add_lru_vma(folio, vma); pgtable_trans_huge_deposit(mm, pmd, pgtable); - set_pmd_at(mm, address, pmd, _pmd); - update_mmu_cache_pmd(vma, address, pmd); - deferred_split_folio(folio, false); + map_anon_folio_pmd(folio, pmd, vma, address, false); spin_unlock(pmd_ptl); folio = NULL; ``` Untested, though. > >> Fixes: 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") >> Signed-off-by: Wei Yang >> Cc: David Hildenbrand >> Cc: Lance Yang >> Cc: Dev Jain >> Cc: >> > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id yFrxMWbZ3WjqZg4AYBR5ng (envelope-from ) for ; Thu, 02 Oct 2025 01:46:14 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Thu, 02 Oct 2025 01:46:14 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v48Oc-00000003zAD-2MFC for hi@josie.lol; Thu, 02 Oct 2025 01:46:14 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id AA81D3C21BA for ; Thu, 2 Oct 2025 01:46:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B173E442C; Thu, 2 Oct 2025 01:46:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cvKW1Ghi" X-Original-To: stable@vger.kernel.org Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFDE63C33 for ; Thu, 2 Oct 2025 01:46:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759369570; cv=none; b=LKV4Y6zpOuh/eBjh+sc4jsUlXmax3tDL243DNzXBvgehXmUv7wQrJ006M6kLecLg7YSzjV+speZ0EoS7vP8TrqQCegPrlqc6sNk6MpsZMLN9U4VhDp/wR8DDvQWJShSqwtl9o2QipIrLHU0sAikbLiOWqUH3qh+MpQh2MCaCdqc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759369570; c=relaxed/simple; bh=up/T6Dc7mr8fc3iJMDUkN2JSekxIApz4YRizv7qxyzY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HL/tp8grUNl4pJOyge+/+FKOLdDpIhQ18fZxbbFJplBnpwjLrFsO2OuhRx02F60ul5B2fO4LwIjtJ/+/rUE41vS/Gb/SBNo8lZs1uOaShIpG/bQBzpeRR6EDlT7FpoR12KxEUT/jVMb3RtXTEhTk6TUsBoLpdk9kIKU6qlTHpdE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cvKW1Ghi; arc=none smtp.client-ip=209.85.208.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-634a3327ff7so1076456a12.1 for ; Wed, 01 Oct 2025 18:46:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759369565; x=1759974365; darn=vger.kernel.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=1xHe/BzI7Wn0nREN3sG+EtbX3FgeLXjNJMls3Nfj1NQ=; b=cvKW1Ghi0bjg1Mk3tgETbxIeiGPUvF6xdwVvNhXw3pcwZhGEIAJFIxYKz2Fm8huqft 83y0Tfe7ZrinGBx2NOp3OC0kRv4hZ0rrVvC7Y2hTykTJ9QwJ7TQ83T7/Zxd7n2ABBAfO Smi3tVvRxMFQgKQdrqt63J/C1fmjWEMYdPFLHee9pvtmTuck5+Ol50R5VOGlO05w1zv0 XpGXe0RMJ0AbR26ih1cfgPqGJp8Guzb5NvP5B0pW4eg2WRStdQvHg2xu3F03TWzRwwtS O0/K7QwhynzKrHy3yL3M7u09RebA4v6g9ckyPI8XiegsC+LthNvjo4i4RufpKEG/NSXP sjTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759369565; x=1759974365; h=user-agent:in-reply-to:content-disposition:mime-version:references :reply-to:message-id:subject:cc:to:from:date:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=1xHe/BzI7Wn0nREN3sG+EtbX3FgeLXjNJMls3Nfj1NQ=; b=o1lULoHL5f9116XVdCixKvVi2mhqRI/Dd5RXsNdwaKydsJo66htWXgswi/YpLY3R7h C9ITsT1wb4RJNTqkDl7jicQj5+vmFBmEXr7OTrcmJUoYJKBj75erZE5KTTXJtUgIr9Iv nevmkDm1MmEjz7+djFs2ta9b44SUPvlnwExMkX331n4A/xcHvUTUx/dLCZFdrW5I7WCM 81PLGXBTYwKGEXUP/FIHTkSak0X35FxM4zemGsFu7OcoYyoohB5FOfSneRnTNLZNRG6k 4bk5SCzpmbIPghuF1824eagdB2ej+b/HYYWmc5FriUp0Wd/Mm6rP/51hsqC4MzQKqAx0 +bxQ== X-Forwarded-Encrypted: i=1; AJvYcCXyeDq8lNIpeK0gFxGiOLIncsqV2/KDQsLgPGQ9HGX8CoXEbNGw45QSqzR3rfJVc9Jt+ZXStL8=@vger.kernel.org X-Gm-Message-State: AOJu0Yz+KdCPK30CarDL0F3eg7xR97CvTe+NNAtvRbNq1pknOsPawUDr 4bLtsND2BcKO+HLMjM5OtJ9hfrX5/gLXxcNuZK4y5ix7BoY/ZS81kADu X-Gm-Gg: ASbGnctALkS0AFMm9KujwN2zSs7rTsG6W6Nl91vZ/WuyAbmKCArrJJBpF+KLR4BVcj0 GMSEV+3WoRQljaHkCY7/EvHLwiqpVRfC3igU8zh7CAzVaumQki4EjdNL+/kZIIKrWh2VwVQRf4w 3NS141+Ni8cV85EPJXIvnRg/bztzy68gyTL6CaVtK0bMuSq0FL/w1F3WAShFMkuXYNP5N4ofZXT e1eK2MdlSFp9qlsSWUuMtPnRGTGVkEHCzuJiMjRt9YBnqePhyBTkQOmShqCDa9SIHloPxk9lpsV Tf2g7ksgNjbjsJfrdeCVWl6qviNOm/Mh8sXQZH4vcoTchYIDc2PiB8aLgjcA74gG7rGyYs1Inm/ EtrjQp/Bs2td+uQeoXUwg2ISmquE1DP6NArqKFq9eoh7I8GG6lg== X-Google-Smtp-Source: AGHT+IGRgLhCs6G3HsEK2WLx4hBYdgbS142jXanEuUtlsvPi9RCUlq5c5Mm2HncdU0tePK8y2sKKTw== X-Received: by 2002:a17:906:68cd:b0:b48:70a3:d45a with SMTP id a640c23a62f3a-b4870a3d69amr97232966b.64.1759369565026; Wed, 01 Oct 2025 18:46:05 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b48652a9ebbsm88540266b.7.2025.10.01.18.46.04 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Oct 2025 18:46:04 -0700 (PDT) Date: Thu, 2 Oct 2025 01:46:04 +0000 From: Wei Yang To: Wei Yang Cc: akpm@linux-foundation.org, david@redhat.com, lorenzo.stoakes@oracle.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com, Liam.Howlett@oracle.com, npache@redhat.com, ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org, lance.yang@linux.dev, wangkefeng.wang@huawei.com, linux-mm@kvack.org, stable@vger.kernel.org Subject: Re: [Patch v2] mm/huge_memory: add pmd folio to ds_queue in do_huge_zero_wp_pmd() Message-ID: <20251002014604.d2ryohvtrdfn7mvf@master> Reply-To: Wei Yang References: <20251002013825.20448-1-richard.weiyang@gmail.com> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251002013825.20448-1-richard.weiyang@gmail.com> User-Agent: NeoMutt/20170113 (1.7.2) X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.178.88.99 listed in sa-accredit.habeas.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [richard.weiyang[at]gmail.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.178.88.99 listed in bl.score.senderscore.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On Thu, Oct 02, 2025 at 01:38:25AM +0000, Wei Yang wrote: >We add pmd folio into ds_queue on the first page fault in >__do_huge_pmd_anonymous_page(), so that we can split it in case of >memory pressure. This should be the same for a pmd folio during wp >page fault. > >Commit 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") miss >to add it to ds_queue, which means system may not reclaim enough memory >in case of memory pressure even the pmd folio is under used. > >Move deferred_split_folio() into map_anon_folio_pmd() to make the pmd >folio installation consistent. > Since we move deferred_split_folio() into map_anon_folio_pmd(), I am thinking about whether we can consolidate the process in collapse_huge_page(). Use map_anon_folio_pmd() in collapse_huge_page(), but skip those statistic adjustment. >Fixes: 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") >Signed-off-by: Wei Yang >Cc: David Hildenbrand >Cc: Lance Yang >Cc: Dev Jain >Cc: > -- Wei Yang Help you, Help me From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id UH9QOpvX3WibyAMAYBR5ng (envelope-from ) for ; Thu, 02 Oct 2025 01:38:35 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Thu, 02 Oct 2025 01:38:35 +0000 Received: from ny.mirrors.kernel.org ([147.75.199.223]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v48HD-00000003klU-3Gu9 for hi@josie.lol; Thu, 02 Oct 2025 01:38:35 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id CB0D21C633A for ; Thu, 2 Oct 2025 01:38:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E78F51E4AB; Thu, 2 Oct 2025 01:38:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VTpduTkN" X-Original-To: stable@vger.kernel.org Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 044A1A59 for ; Thu, 2 Oct 2025 01:38:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759369112; cv=none; b=iQ/9iSy8s9NlbqGmC45NMqch4oJHfyKi/FsMaGJRN/m7YR+1bFkxaFH3JS2PaIoZo/Ts4OCbUNhhloGEMcfDNxcaH41wKBsCRuib6xfj3yxzMoBdtKzJpXwrIkOlj1esZ74hs9VVgnTzu+L6s8h0kU216UlK/xa5nxUSHG+xfVQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759369112; c=relaxed/simple; bh=8YzC51JPZ0HB5StgwEw+cbANxX6bc+oN2mcNNFa/M/U=; h=From:To:Cc:Subject:Date:Message-Id; b=X7xW7eR0P1gvJqQzkZEAivzjpintw+Ce2zu7cEvYU6ykGkIAXEEcfNyLXX7mURPxtd77zNdCfrn6RWqpePXFjoxtIc4DTupAbWGXBGMALwoBqAJ0V/u9CZZil+fDwZhwgqIRlIn2JAypHUA82R2iQF5Obg4UoGad5QZBsgppwPA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VTpduTkN; arc=none smtp.client-ip=209.85.218.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-b3b27b50090so100982166b.0 for ; Wed, 01 Oct 2025 18:38:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759369109; x=1759973909; darn=vger.kernel.org; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BDDnGBDOOGji4bOsQZ3Ul8bZ6/fdo9llPBcLLrM9Xhw=; b=VTpduTkNOM+6qS6UWVJ8Dut+8Iql0fHSoPvG0KXmiQg8LEV9i2tTJ49RO4LPIu2I/Q XXQtOx2up6Zg1/ImPJyd1zDvsrXpkJkWUvl4HWmmETKgDIeET2j6TJhGtvCPDwsfX6uh 7aWhtJfrp+ZpPzMP7aYPKV/goyrdGtgNF0NX8G8t1NbIr8A1OARBFSed7SHHIAeJIYpu 8eBW8dHxJ1JoAdtdD1H1Ko9VQMyXAu9ZIJAFqj0hvGNRPbpRlEn0lMIK83fhpwa3gCwD glJbOVG9Mnkmza+j8rdvpDo6EQ1LJ/oH6+l/D9mZE4DHIfEt5Fr5fEPEju86+xsTGmZU dz5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759369109; x=1759973909; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BDDnGBDOOGji4bOsQZ3Ul8bZ6/fdo9llPBcLLrM9Xhw=; b=FuqaLhYTsOPLQ7y/z7llDUfMm0tiNncIQytiaR+ljn3+dMRdqQb7WleWM/e2owRQh4 mun1pIGJMI1WTUGjFz97Zj1J7bTpICskztmsaZuMQUtlXeM1LIUfbUz4F7d1xMlbpHb4 ti8lGAQ1n4jAEsP8jon5r739VcLcqYyXBrHsCU33mPim5vKTyLPlJ3GUU3nfrp3wiQPb xQulRzsvABvlihUU8NiqNs7Qck8a5Z9gSK4+Pt21v7YUOyz0tW54QZKpAh69MMelh48x PrdqSpd0eKDwCyYbfDF26XtnRTWwMMspcv/4ncab/2QSHYORH274/2XEX33uZtF1HhYM Kd0A== X-Forwarded-Encrypted: i=1; AJvYcCWicmJh4tQVsLMjyJc2J2EGWcf04cRvVfYaYPu2t88qT9rpcWn4tBXqXi+iJunYjQwRjxFpEkU=@vger.kernel.org X-Gm-Message-State: AOJu0Yy8Slg6yzUJSDUBlze943VTSiYHi2o/nu7nnbnMPooQT5fvHWno rCjuWpaaXfmrtByQhXhliecBP+D2N/g/DcEEbD2JOlf5bEbBHyDZAvSz X-Gm-Gg: ASbGnctRO3igNdgOaDgZ7rw6gfBktvrLfeNyQrX6dCboD3LBhc8mc/1A+T11sJVduhn RaUSE8XevxFYr+5+XguXFGXY5uouj6DoLcZxkhK05BfuGcB2lgOVgI5ENA/ul6apjsv78cbyvK5 dTZSq4gqef3zYrbh0jLWGUySoaWtwAJ9sdFt9eyzzNJ1rjlEFh6BJw5ktjzZmwUln0YEsQ4fIAk dcskCLDXnvLlV7zVXV8Nk8ChctEQffIuDC4cUf5LzXhO7me304nnD1gtO6AmPrG6qzIcLEuacAo 543TIS7aZ3POu3CSsdSjevzEiYKaEQ3ZCRTFo2SqXgX6LNLniIVbw9RzP8McvkZjtBC17DyKtjD dBpE4hX6DVKf6isj0EpSLNzEGZq4irqzbYv1Fqr2IofW/PV+UAQ== X-Google-Smtp-Source: AGHT+IGYkhK9D83thDffjxtcF3fdgyIYZDpOc53LuXBxHq3bDwX85vgQKbTPEoz+O+2+HOtqs+z6Qw== X-Received: by 2002:a17:907:6d0b:b0:b46:abad:430e with SMTP id a640c23a62f3a-b46e47910c6mr675645966b.37.1759369109107; Wed, 01 Oct 2025 18:38:29 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b486970b32bsm87824466b.50.2025.10.01.18.38.28 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Oct 2025 18:38:28 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org, david@redhat.com, lorenzo.stoakes@oracle.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com, Liam.Howlett@oracle.com, npache@redhat.com, ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org, lance.yang@linux.dev, wangkefeng.wang@huawei.com Cc: linux-mm@kvack.org, Wei Yang , stable@vger.kernel.org Subject: [Patch v2] mm/huge_memory: add pmd folio to ds_queue in do_huge_zero_wp_pmd() Date: Thu, 2 Oct 2025 01:38:25 +0000 Message-Id: <20251002013825.20448-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.199.223 listed in sa-accredit.habeas.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [richard.weiyang[at]gmail.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.199.223 listed in bl.score.senderscore.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 We add pmd folio into ds_queue on the first page fault in __do_huge_pmd_anonymous_page(), so that we can split it in case of memory pressure. This should be the same for a pmd folio during wp page fault. Commit 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") miss to add it to ds_queue, which means system may not reclaim enough memory in case of memory pressure even the pmd folio is under used. Move deferred_split_folio() into map_anon_folio_pmd() to make the pmd folio installation consistent. Fixes: 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") Signed-off-by: Wei Yang Cc: David Hildenbrand Cc: Lance Yang Cc: Dev Jain Cc: --- v2: * add fix, cc stable and put description about the flow of current code * move deferred_split_folio() into map_anon_folio_pmd() --- mm/huge_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 1b81680b4225..f13de93637bf 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1232,6 +1232,7 @@ static void map_anon_folio_pmd(struct folio *folio, pmd_t *pmd, count_vm_event(THP_FAULT_ALLOC); count_mthp_stat(HPAGE_PMD_ORDER, MTHP_STAT_ANON_FAULT_ALLOC); count_memcg_event_mm(vma->vm_mm, THP_FAULT_ALLOC); + deferred_split_folio(folio, false); } static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf) @@ -1272,7 +1273,6 @@ static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf) pgtable_trans_huge_deposit(vma->vm_mm, vmf->pmd, pgtable); map_anon_folio_pmd(folio, vmf->pmd, vma, haddr); mm_inc_nr_ptes(vma->vm_mm); - deferred_split_folio(folio, false); spin_unlock(vmf->ptl); } -- 2.34.1 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id EOvTCMrY7WhfoxwAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 04:59:54 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 04:59:54 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8X8b-00000008Qje-2yqm for hi@josie.lol; Tue, 14 Oct 2025 04:59:54 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id BCD924E3498 for ; Tue, 14 Oct 2025 04:59:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0420B30CDB4; Tue, 14 Oct 2025 04:59:51 +0000 (UTC) X-Original-To: stable@vger.kernel.org Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C61C30CDAE for ; Tue, 14 Oct 2025 04:59:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760417990; cv=none; b=mbppgdphxRQlNVAUI5i82kHqkFK/DI89xQDITwOL9UZj5QVYWjO7mtK1xG1UWuR7WdJ2wBiZjeheFAwVvB1ONVUemdtOw72Mi5znNh9RwoOYugo16IDJw4YEZYmbFGWcxXBgumrOQkG4dYh5aDRmOETX9QcIbFp454EHCY2X57Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760417990; c=relaxed/simple; bh=XrXf8F/xtbgKNN/s4AA2++vwld5mD4/9QMIYMN9HtiI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UCXwFjwM07AhP0VTnZ2Q6jSjXPyDsGdEJ693sg6uFe+nGdRJOzKs7nSQUtNdX62AICe00W6MFUKxY/F+K8agofTqzMSGXA0GdH6enTiLqdojup8Exk2vMapGc/nzdkzZOUFvuAHTuY1stknGlTYICVkB6YrJeU2U/YWs9jSdLpo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.215.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-b631b435d59so3130347a12.0 for ; Mon, 13 Oct 2025 21:59:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760417986; x=1761022786; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j7IUlAhB88E0TndW9aY0W3O4BbLrJPatp6viH0im4zM=; b=FwGU1/XLBiO0dlJaEx9zOsCTqQ8OuA44qFdWBpE2KUZDItrwXk9EuM2G9Fpx9d7CvK aAh3LJLFeJ6uqQ2acMd/vd8ztG8093PmiYVF1hMZsuZRMKGIPqCg6Gt/15PlJ0lfEEcn 0ib04GcdRo3RrWi0hRf2/w52VrNY3pnOLNx3NsXm+f8CvFttL83YTyOh5lI13DotLO+/ ygEqxblXEIRmS77JqkR/x4yXoIeRsUpBaVn3Ws2CQ7Je3+jD3zedGzTDWlRBqTtvqU7/ gvY6I6c644RV311ipSg94SXjo2R4SQn0u7+q5bKiVNyPmIhtywHnVYiw87du4tsVNq3d dMrQ== X-Gm-Message-State: AOJu0YxHYFeLEU+iAMdEW4SitxVwPdEmy0tigzdvjikoUMwr/XZwdlyL aJ/CV06baspDDsJDrObDQ7lidLzDyshsE2UJ+WRUA8Iu/w0BYVFwsEYpfiLK9Ftm X-Gm-Gg: ASbGncu01aOzk5mIMFeS2E/8ZuzTbQlmiI+2XTeumNic7TE8a6I6VPKiAKp0UC/DG5h JZ5ZmWGW3HHLvc4rDn+DaOKgNINJdLs8Cs1XNYDGbkDuDlEW3GbO2TkPrDSVuqGMshnk9demvSa 2dIAGIe3sZIC8rn/u5YAu+y61FK478y2uMTFlQ9h34PHmpG/1p35IkdVZiTNwUrOurO9hPbfTts e07O+DsOze//M2ZArxAoZguxHXcuCEP2sjWdtnH+Ug4+sCO17LpbqEj/TGIvd99B8vDmZgWW5+w R7zmQZv7atgbCsr34gqumNN1GpdY11130+E73zVD/7cFqo4B3y5mLOajvd+r6tJV6xNVJec5nIo wZ20GuDIIrO5J8ZvszgWEgAMEJOOVXj69TX5nRujy X-Google-Smtp-Source: AGHT+IFjFdZHGXT/x9wuBsdsKcMSUOCZEq1MwGHaq7Dd+Jdf9jADzgCkgSMal9VmF64Wpt1ilzESQw== X-Received: by 2002:a17:902:da8e:b0:26a:589b:cf11 with SMTP id d9443c01a7336-29027402d24mr340881805ad.43.1760417986016; Mon, 13 Oct 2025 21:59:46 -0700 (PDT) Received: from EBJ9932692.tcent.cn ([2a11:3:200::202c]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29034e39727sm149783765ad.51.2025.10.13.21.59.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Oct 2025 21:59:45 -0700 (PDT) From: Lance Yang To: stable@vger.kernel.org Cc: linux-mm@kvack.org, ioworker0@gmail.com, Lance Yang , David Hildenbrand , Lorenzo Stoakes , Shuah Khan , Gabriel Krisman Bertazi , Andrew Morton Subject: [PATCH 6.1.y 1/1] selftests/mm: skip soft-dirty tests when CONFIG_MEM_SOFT_DIRTY is disabled Date: Tue, 14 Oct 2025 12:59:31 +0800 Message-ID: <20251014045931.86386-1-lance.yang@linux.dev> X-Mailer: git-send-email 2.49.0 In-Reply-To: <2025101330-hemstitch-crimson-1681@gregkh> References: <2025101330-hemstitch-crimson-1681@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.5 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 5 From: Lance Yang The madv_populate and soft-dirty kselftests currently fail on systems where CONFIG_MEM_SOFT_DIRTY is disabled. Introduce a new helper softdirty_supported() into vm_util.c/h to ensure tests are properly skipped when the feature is not enabled. Link: https://lkml.kernel.org/r/20250917133137.62802-1-lance.yang@linux.dev Fixes: 9f3265db6ae8 ("selftests: vm: add test for Soft-Dirty PTE bit") Signed-off-by: Lance Yang Acked-by: David Hildenbrand Suggested-by: David Hildenbrand Cc: Lorenzo Stoakes Cc: Shuah Khan Cc: Gabriel Krisman Bertazi Cc: Signed-off-by: Andrew Morton (cherry picked from commit 0389c305ef56cbadca4cbef44affc0ec3213ed30) --- tools/testing/selftests/vm/madv_populate.c | 9 ++- tools/testing/selftests/vm/soft-dirty.c | 5 +- tools/testing/selftests/vm/vm_util.c | 77 ++++++++++++++++++++++ tools/testing/selftests/vm/vm_util.h | 2 + 4 files changed, 90 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/vm/madv_populate.c b/tools/testing/selftests/vm/madv_populate.c index 715a42e8e2cd..f37bda59c18c 100644 --- a/tools/testing/selftests/vm/madv_populate.c +++ b/tools/testing/selftests/vm/madv_populate.c @@ -274,12 +274,16 @@ static void test_softdirty(void) int main(int argc, char **argv) { + int nr_tests = 16; int err; pagesize = getpagesize(); + if (softdirty_supported()) + nr_tests += 5; + ksft_print_header(); - ksft_set_plan(21); + ksft_set_plan(nr_tests); sense_support(); test_prot_read(); @@ -287,7 +291,8 @@ int main(int argc, char **argv) test_holes(); test_populate_read(); test_populate_write(); - test_softdirty(); + if (softdirty_supported()) + test_softdirty(); err = ksft_get_fail_cnt(); if (err) diff --git a/tools/testing/selftests/vm/soft-dirty.c b/tools/testing/selftests/vm/soft-dirty.c index 21d8830c5f24..615ab2d204ef 100644 --- a/tools/testing/selftests/vm/soft-dirty.c +++ b/tools/testing/selftests/vm/soft-dirty.c @@ -190,8 +190,11 @@ int main(int argc, char **argv) int pagesize; ksft_print_header(); - ksft_set_plan(15); + if (!softdirty_supported()) + ksft_exit_skip("soft-dirty is not support\n"); + + ksft_set_plan(15); pagemap_fd = open(PAGEMAP_FILE_PATH, O_RDONLY); if (pagemap_fd < 0) ksft_exit_fail_msg("Failed to open %s\n", PAGEMAP_FILE_PATH); diff --git a/tools/testing/selftests/vm/vm_util.c b/tools/testing/selftests/vm/vm_util.c index f11f8adda521..fc5743bc1283 100644 --- a/tools/testing/selftests/vm/vm_util.c +++ b/tools/testing/selftests/vm/vm_util.c @@ -72,6 +72,42 @@ uint64_t read_pmd_pagesize(void) return strtoul(buf, NULL, 10); } +char *__get_smap_entry(void *addr, const char *pattern, char *buf, size_t len) +{ + int ret; + FILE *fp; + char *entry = NULL; + char addr_pattern[MAX_LINE_LENGTH]; + + ret = snprintf(addr_pattern, MAX_LINE_LENGTH, "%08lx-", + (unsigned long)addr); + if (ret >= MAX_LINE_LENGTH) + ksft_exit_fail_msg("%s: Pattern is too long\n", __func__); + + fp = fopen(SMAP_FILE_PATH, "r"); + if (!fp) + ksft_exit_fail_msg("%s: Failed to open file %s\n", __func__, + SMAP_FILE_PATH); + + if (!check_for_pattern(fp, addr_pattern, buf, len)) + goto err_out; + + /* Fetch the pattern in the same block */ + if (!check_for_pattern(fp, pattern, buf, len)) + goto err_out; + + /* Trim trailing newline */ + entry = strchr(buf, '\n'); + if (entry) + *entry = '\0'; + + entry = buf + strlen(pattern); + +err_out: + fclose(fp); + return entry; +} + bool __check_huge(void *addr, char *pattern, int nr_hpages, uint64_t hpage_size) { @@ -124,3 +160,44 @@ bool check_huge_shmem(void *addr, int nr_hpages, uint64_t hpage_size) { return __check_huge(addr, "ShmemPmdMapped:", nr_hpages, hpage_size); } + +static bool check_vmflag(void *addr, const char *flag) +{ + char buffer[MAX_LINE_LENGTH]; + const char *flags; + size_t flaglen; + + flags = __get_smap_entry(addr, "VmFlags:", buffer, sizeof(buffer)); + if (!flags) + ksft_exit_fail_msg("%s: No VmFlags for %p\n", __func__, addr); + + while (true) { + flags += strspn(flags, " "); + + flaglen = strcspn(flags, " "); + if (!flaglen) + return false; + + if (flaglen == strlen(flag) && !memcmp(flags, flag, flaglen)) + return true; + + flags += flaglen; + } +} + +bool softdirty_supported(void) +{ + char *addr; + bool supported = false; + const size_t pagesize = getpagesize(); + + /* New mappings are expected to be marked with VM_SOFTDIRTY (sd). */ + addr = mmap(0, pagesize, PROT_READ | PROT_WRITE, + MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); + if (!addr) + ksft_exit_fail_msg("mmap failed\n"); + + supported = check_vmflag(addr, "sd"); + munmap(addr, pagesize); + return supported; +} diff --git a/tools/testing/selftests/vm/vm_util.h b/tools/testing/selftests/vm/vm_util.h index 5c35de454e08..470f85fe9594 100644 --- a/tools/testing/selftests/vm/vm_util.h +++ b/tools/testing/selftests/vm/vm_util.h @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 */ #include #include +#include uint64_t pagemap_get_entry(int fd, char *start); bool pagemap_is_softdirty(int fd, char *start); @@ -10,3 +11,4 @@ uint64_t read_pmd_pagesize(void); bool check_huge_anon(void *addr, int nr_hpages, uint64_t hpage_size); bool check_huge_file(void *addr, int nr_hpages, uint64_t hpage_size); bool check_huge_shmem(void *addr, int nr_hpages, uint64_t hpage_size); +bool softdirty_supported(void); -- 2.49.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id sAvaCvjl7Gh6xx0AYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 11:43:52 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 11:43:52 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8Gxz-00000008gOV-37yv for hi@josie.lol; Mon, 13 Oct 2025 11:43:52 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0BF603B4C8C for ; Mon, 13 Oct 2025 11:43:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 13B6D25DD07; Mon, 13 Oct 2025 11:43:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="eDkwnkDw" X-Original-To: stable@vger.kernel.org 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 E248014A8B for ; Mon, 13 Oct 2025 11:43:48 +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=1760355829; cv=none; b=AMowUJck5xEfgblptq1Qwkk08XpI/3T0AUnKjY+LgdBOcN+79U6tQgUvCaLn8+WfFdvZzgbU+yzHgxyEEeFSb+C1TP9tL4aNRZ7OyM1lWH61mSNwRhaz1E+gOxQEJnRh3I5JkjYYFE+zQXWWAb/RzrjUcf4wHMy0m9d/CyyH0zw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760355829; c=relaxed/simple; bh=4RJwrqztKs46Q40ucJo0C29fflsoncz7vv3Gb4wdMUQ=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=EThh/icONrzi4OaNYkj8pr9tbhxzvJw5aLqZmL9mq0UNar8Fu4Yd2b51lBtTZdOH23xIMyX5351WDyTtebg3KgG0jm6B8PnBalrtHsmNRU0DLyJ3Ze+OuizJCvowxKCJe1t5v/Oc13wyfN1GZh72nksVh0oEeBPttWP4Z93eIXE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=eDkwnkDw; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D642C4CEE7; Mon, 13 Oct 2025 11:43:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760355828; bh=4RJwrqztKs46Q40ucJo0C29fflsoncz7vv3Gb4wdMUQ=; h=Subject:To:Cc:From:Date:From; b=eDkwnkDw4TLHRZ1haq9ImyHGRDwa4L4x7765UG5JNwSlsQc3UH1LMejNsw1shZwOo oMkjYMnyThGVSx5rFfXesKhxSy5Vvka/S8klBZ0ObYAJqix5OSn+my4fAKjwD7upgh mO9os6D74unCjQozLNnMwLVjn+2jmgG0gsP0KK7o= Subject: FAILED: patch "[PATCH] selftests/mm: skip soft-dirty tests when" failed to apply to 6.1-stable tree To: lance.yang@linux.dev,akpm@linux-foundation.org,david@redhat.com,krisman@collabora.com,lorenzo.stoakes@oracle.com,shuah@kernel.org,stable@vger.kernel.org Cc: From: Date: Mon, 13 Oct 2025 13:43:30 +0200 Message-ID: <2025101330-hemstitch-crimson-1681@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit X-DKIM: signer='linuxfoundation.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -18 The patch below does not apply to the 6.1-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y git checkout FETCH_HEAD git cherry-pick -x 0389c305ef56cbadca4cbef44affc0ec3213ed30 # git commit -s git send-email --to '' --in-reply-to '2025101330-hemstitch-crimson-1681@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 0389c305ef56cbadca4cbef44affc0ec3213ed30 Mon Sep 17 00:00:00 2001 From: Lance Yang Date: Wed, 17 Sep 2025 21:31:37 +0800 Subject: [PATCH] selftests/mm: skip soft-dirty tests when CONFIG_MEM_SOFT_DIRTY is disabled The madv_populate and soft-dirty kselftests currently fail on systems where CONFIG_MEM_SOFT_DIRTY is disabled. Introduce a new helper softdirty_supported() into vm_util.c/h to ensure tests are properly skipped when the feature is not enabled. Link: https://lkml.kernel.org/r/20250917133137.62802-1-lance.yang@linux.dev Fixes: 9f3265db6ae8 ("selftests: vm: add test for Soft-Dirty PTE bit") Signed-off-by: Lance Yang Acked-by: David Hildenbrand Suggested-by: David Hildenbrand Cc: Lorenzo Stoakes Cc: Shuah Khan Cc: Gabriel Krisman Bertazi Cc: Signed-off-by: Andrew Morton diff --git a/tools/testing/selftests/mm/madv_populate.c b/tools/testing/selftests/mm/madv_populate.c index b6fabd5c27ed..d8d11bc67ddc 100644 --- a/tools/testing/selftests/mm/madv_populate.c +++ b/tools/testing/selftests/mm/madv_populate.c @@ -264,23 +264,6 @@ static void test_softdirty(void) munmap(addr, SIZE); } -static int system_has_softdirty(void) -{ - /* - * There is no way to check if the kernel supports soft-dirty, other - * than by writing to a page and seeing if the bit was set. But the - * tests are intended to check that the bit gets set when it should, so - * doing that check would turn a potentially legitimate fail into a - * skip. Fortunately, we know for sure that arm64 does not support - * soft-dirty. So for now, let's just use the arch as a corse guide. - */ -#if defined(__aarch64__) - return 0; -#else - return 1; -#endif -} - int main(int argc, char **argv) { int nr_tests = 16; @@ -288,7 +271,7 @@ int main(int argc, char **argv) pagesize = getpagesize(); - if (system_has_softdirty()) + if (softdirty_supported()) nr_tests += 5; ksft_print_header(); @@ -300,7 +283,7 @@ int main(int argc, char **argv) test_holes(); test_populate_read(); test_populate_write(); - if (system_has_softdirty()) + if (softdirty_supported()) test_softdirty(); err = ksft_get_fail_cnt(); diff --git a/tools/testing/selftests/mm/soft-dirty.c b/tools/testing/selftests/mm/soft-dirty.c index 8a3f2b4b2186..4ee4db3750c1 100644 --- a/tools/testing/selftests/mm/soft-dirty.c +++ b/tools/testing/selftests/mm/soft-dirty.c @@ -200,8 +200,11 @@ int main(int argc, char **argv) int pagesize; ksft_print_header(); - ksft_set_plan(15); + if (!softdirty_supported()) + ksft_exit_skip("soft-dirty is not support\n"); + + ksft_set_plan(15); pagemap_fd = open(PAGEMAP_FILE_PATH, O_RDONLY); if (pagemap_fd < 0) ksft_exit_fail_msg("Failed to open %s\n", PAGEMAP_FILE_PATH); diff --git a/tools/testing/selftests/mm/vm_util.c b/tools/testing/selftests/mm/vm_util.c index 56e9bd541edd..e33cda301dad 100644 --- a/tools/testing/selftests/mm/vm_util.c +++ b/tools/testing/selftests/mm/vm_util.c @@ -449,6 +449,23 @@ bool check_vmflag_pfnmap(void *addr) return check_vmflag(addr, "pf"); } +bool softdirty_supported(void) +{ + char *addr; + bool supported = false; + const size_t pagesize = getpagesize(); + + /* New mappings are expected to be marked with VM_SOFTDIRTY (sd). */ + addr = mmap(0, pagesize, PROT_READ | PROT_WRITE, + MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); + if (!addr) + ksft_exit_fail_msg("mmap failed\n"); + + supported = check_vmflag(addr, "sd"); + munmap(addr, pagesize); + return supported; +} + /* * Open an fd at /proc/$pid/maps and configure procmap_out ready for * PROCMAP_QUERY query. Returns 0 on success, or an error code otherwise. diff --git a/tools/testing/selftests/mm/vm_util.h b/tools/testing/selftests/mm/vm_util.h index 07c4acfd84b6..26c30fdc0241 100644 --- a/tools/testing/selftests/mm/vm_util.h +++ b/tools/testing/selftests/mm/vm_util.h @@ -104,6 +104,7 @@ bool find_vma_procmap(struct procmap_fd *procmap, void *address); int close_procmap(struct procmap_fd *procmap); int write_sysfs(const char *file_path, unsigned long val); int read_sysfs(const char *file_path, unsigned long *val); +bool softdirty_supported(void); static inline int open_self_procmap(struct procmap_fd *procmap_out) { From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id wKLeIknp7WiO9SAAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 06:10:17 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 06:10:17 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8YEj-0000000AeXg-1AMM for hi@josie.lol; Tue, 14 Oct 2025 06:10:17 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 6BDCA4F63A7 for ; Tue, 14 Oct 2025 06:10:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C7932EC08B; Tue, 14 Oct 2025 06:10:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kuLephhf" X-Original-To: stable@vger.kernel.org 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 6CD8229B8D9 for ; Tue, 14 Oct 2025 06:10:10 +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=1760422210; cv=none; b=hskOlzuxY3yMsuRafOvHk7WLS/IbtcoJQypdmhSHIVtIL9XJQd13LzgMmQRyZj3j+fftZrxU6YQDAElFO5mJlbTfR3d/LjypJ0i9j73GpWqV5YiL57n5NzMDFJT9rsJWHjJjTnmqiyO2EZBfRSKj2tG40Tli2sbsoxh5zLC8jns= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760422210; c=relaxed/simple; bh=79FkngLdByzitiPurcit70xJmkJLaN+TwOHbR2oTuR4=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=d01VeH0Sfg9HPk5W6t4UOjDhHAlsj9ewRW7n7zz6UsmUS35BP3mlis0BSL5r6tyDTv5YlmiolM2JyawF6PHEpBI+YbOxztkk0j0XOxyTsLFuQ1GBnDvSS8TnEYC7B4g59LmP+rsb9XgPQKIoYeZ+JAyNblTNqtUtZ9/BuqtEDLs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kuLephhf; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 548AAC19422 for ; Tue, 14 Oct 2025 06:10:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760422208; bh=79FkngLdByzitiPurcit70xJmkJLaN+TwOHbR2oTuR4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=kuLephhfxD57M//oJccqMZYB5507yEEUen7UJdRSOXM/k9jQPKCpZRWaZWXWVbOgL /VUtteuryP9SffBiS2zuxVeUhzum3JULU8KK28EOZLZYvpb4G6fJ8n8pNViFnn92yX TaUrNemNaN9ZEroWztyfFZaD91287CU/cNETRz103CQQjgaaCiiHntMw0Xi5OLQiW2 W+CY8J6U4Mj3/Siw8JJ+dGS7nVgyyTGd643eavedTYApF4yJXavvFhboBZjXmKzft5 sZ/fPI2wc/G6hsHpaghDDeDEDqzWIICmFebul71JGtXl3PErl+Oon5fGvQP/kazsvC xmmUxLXA3SRuw== Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-b3b27b50090so916721966b.0 for ; Mon, 13 Oct 2025 23:10:08 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCV+j4pAoV90dfsEZQsWe1HXz2MoS8fugE1oXRuy21M44REy2S0j6cUpHCUoSSZCY3Z6CHsel98=@vger.kernel.org X-Gm-Message-State: AOJu0YzxEwfmnBBB4jOl49NiZ6YaknxCqhwmDmDCJ0I57NIfvRjzfDaW sVFy1o3OFvkP/BqLWgIH8GqHb/Qa8eVcIz0jmuAyDzuqVsWr3Eh65uv1QwnmXJNn37pfleI3HNy XBpRSvFgNRCuiI8bx89fPHwBpFR0M2aU= X-Google-Smtp-Source: AGHT+IF1ClqteeO20q49joylEJPuOBRHUbMKMOsjSsX528jdJGEYW1mrj3fg0H1Zru6dS/zDbCS48FEXlphBYlCy4SA= X-Received: by 2002:a17:906:6a2a:b0:b42:7c2:1f9f with SMTP id a640c23a62f3a-b50acc1aa50mr2523622066b.62.1760422206721; Mon, 13 Oct 2025 23:10:06 -0700 (PDT) Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20251013134708.1270704-1-aha310510@gmail.com> <20251013164625.nphymwx25fde5eyk@pali> In-Reply-To: From: Namjae Jeon Date: Tue, 14 Oct 2025 15:09:54 +0900 X-Gmail-Original-Message-ID: X-Gm-Features: AS18NWAYnFO0rH9xSxpzDOVJvKVli0eC4_KuUr1J7eZ_4pNu4t3yWUOEpQv4q9U Message-ID: Subject: Re: [PATCH v3] exfat: fix out-of-bounds in exfat_nls_to_ucs2() To: Jeongjun Park Cc: =?UTF-8?Q?Pali_Roh=C3=A1r?= , Ethan Ferguson , Sungjong Seo , Yuezhang Mo , Al Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, syzbot+98cc76a76de46b3714d4@syzkaller.appspotmail.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.2 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.2 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: man7.org] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -11 On Tue, Oct 14, 2025 at 3:04=E2=80=AFPM Jeongjun Park = wrote: > > Hi Namjae, > > Namjae Jeon wrote: > > > > On Tue, Oct 14, 2025 at 1:46=E2=80=AFAM Pali Roh=C3=A1r wrote: > > > > > > On Monday 13 October 2025 22:47:08 Jeongjun Park wrote: > > > > Since the len argument value passed to exfat_ioctl_set_volume_label= () > > > > from exfat_nls_to_utf16() is passed 1 too large, an out-of-bounds r= ead > > > > occurs when dereferencing p_cstring in exfat_nls_to_ucs2() later. > > > > > > > > And because of the NLS_NAME_OVERLEN macro, another error occurs whe= n > > > > creating a file with a period at the end using utf8 and other iocha= rsets, > > > > so the NLS_NAME_OVERLEN macro should be removed and the len argumen= t value > > > > should be passed as FSLABEL_MAX - 1. > > > > > > > > Cc: > > > > Reported-by: syzbot+98cc76a76de46b3714d4@syzkaller.appspotmail.com > > > > Closes: https://syzkaller.appspot.com/bug?extid=3D98cc76a76de46b371= 4d4 > > > > Fixes: 370e812b3ec1 ("exfat: add nls operations") > > > > > > Fixes: line is for sure wrong as the affected > > > exfat_ioctl_set_volume_label function is not available in the mention= ed > > > commit. > > > > > > I guess it should be commit d01579d590f72d2d91405b708e96f6169f24775a. > > > > > > Now I have looked at that commit and I think I finally understood wha= t > > > was the issue. exfat_nls_to_utf16() function is written in a way that > > > it expects null-term string and its strlen as 3rd argument. > > > > > > This was achieved for all code paths except the new one introduced in > > > that commit. "label" is declared as char label[FSLABEL_MAX]; so the > > > FSLABEL_MAX argument in exfat_nls_to_utf16() is effectively > > > sizeof(label). And here comes the problem, it should have been > > > strlen(label) (or rather strnlen(label, sizeof(label)-1) in case > > > userspace pass non-nul term string). > > > > > > So the change below to FSLABEL_MAX - 1 effectively fix the overflow > > > problem. But not the usage of exfat_nls_to_utf16. > > > > > > API of FS_IOC_SETFSLABEL is defined to always take nul-term string: > > > https://man7.org/linux/man-pages/man2/fs_ioc_setfslabel.2const.html > > > > > > And size of buffer is not the length of nul-term string. We should > > > discard anything after nul-term byte. > > > > > > So in my opinion exfat_ioctl_set_volume_label() should be fixed in a = way > > > it would call exfat_nls_to_utf16() with 3rd argument passed as: > > > > > > strnlen(label, sizeof(label) - 1) > > > > > > or > > > > > > strnlen(label, FSLABEL_MAX - 1) > > > > > > Or personally I prefer to store this length into new variable (e.g. > > > label_len) and then passing it to exfat_nls_to_utf16() function. > > > For example: > > > > > > ret =3D exfat_nls_to_utf16(sb, label, label_len, &uniname, &lossy); > > Right, I agree. > > > > > > Adding Ethan to CC as author of the mentioned commit. > > > > > > > > > And about NLS_NAME_OVERLEN, it is being used by the > > > __exfat_resolve_path() function. So removal of the "setting" of > > > NLS_NAME_OVERLEN bit but still checking if the NLS_NAME_OVERLEN bit i= s > > > set is quite wrong. > > Right, The use of NLS_NAME_OVERLEN in __exfat_resolve_path() and > > in the header should also be removed. > > I'll write a patch that reflects this analysis and send it to you right > away. > > However, if do this, NLS_NAME_OVERLEN macro is no longer used anywhere > in exfat, so does that mean should also remove the macro define itself? Yes, So I replied that it should be removed in the header. Thanks. > > Regards, > Jeongjun Park From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id ANJ1OgDo7WgowiUAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 06:04:48 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 06:04:48 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8Y9Q-0000000AUEP-2awe for hi@josie.lol; Tue, 14 Oct 2025 06:04:48 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 8C9844F0009 for ; Tue, 14 Oct 2025 06:04:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 17CBA30DD27; Tue, 14 Oct 2025 06:04:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lWdPOu/Z" X-Original-To: stable@vger.kernel.org Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5009230C606 for ; Tue, 14 Oct 2025 06:04:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760421876; cv=none; b=YGdQIQdwOOR1Fyfd9gvrNLDVwb+wjnwssV6/37sN8JHrqt+nalH9kjH8GB8L97bVskIvbuyKvunpueulU+lR5HQ21xfEbztqgn2ZrrIdwPtUdN8MnLAwcOUFj8q95JqH4jRlrF0I68AKkDW3pvcXmOqHtQhbcXMtV/RbSAZLxOw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760421876; c=relaxed/simple; bh=tv0xd/ZLUTxahGhqv/v6XY8qJ/8QWSM/jWNbbSekNAg=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=JVlVNdZysYZ4gKXN1oMSxaE+DqjRPNtY3Ym4gpS0ybgw07H9aCAsY5BneLJnM0AUW0vA3ggAOA2exGaZr/tzF/LuZ2SNLZxcHrD+IHiLcaLT0AvKwuWFDCAdAgOY1rFDen8LCeCIJtpFWb3/vcAdbz9q3sLyGtpE+3GcQRnKFCE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lWdPOu/Z; arc=none smtp.client-ip=209.85.210.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-78af3fe5b17so3932549b3a.2 for ; Mon, 13 Oct 2025 23:04:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760421874; x=1761026674; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=tzZuo7NJ/DlD6SoTWD70pPuh+8rHqp2AyadzZH5QNao=; b=lWdPOu/ZNgdIRmt3s1GU8nzMUufS5orl0aFEZDpsNrFFxMZ1aktwrktG9Mm0gNqVJS ZsH5P2gOaZTSUASdOcgNppZQ16uvad+PgYoEl1W38BSVi+DjmW0D2VKZV3jxx+RC7hdp UNhz84Wp9th9+so84DBjujtRhssnAQ5E06h4LWVuVnwjttbNr8lEIhO61yMHf6zUy/q9 DRneuFReD5qgvX1aCrrSMoWfoJ7+hXff3DPUp0LnDMSgBo0xOpKvD00Tzb0PujvsAspj c7+UvUSE4OB8EWvHjcfs7w/qvUdawh8cDViXP/oJypuwmcIujhlDhFQcWjcSjUl55+lG Np1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760421874; x=1761026674; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tzZuo7NJ/DlD6SoTWD70pPuh+8rHqp2AyadzZH5QNao=; b=sBJoGybvt41WJJUOxY1N9/2CxO/LTqTOi2a0Pc4jtgt+i9oQcaMacJ1BwTkF+0Dscy SgIFbcLHulS9lRGrSI+wxBMGfjJP4jblZfovvwe3GiBVw3llfVqbpYtJLK1roGK5KR7u MXK+pWcUS/QodazBEPK7K0ioRWbu8AYnCwMxi0DQ7KmWBH8yxebgzqLspDFv6XfcGuzg ksl6yq9rZ+6vgBwHvEm7bYUq8UhbzcRjjbWs9d3QbY9jwILosb7GIlmA1BLCI5y0u9kL t4GrOBgK5M+ud+TvL4NTuUUTcYiTRT7ticV8qrQlFH19X98UHn0cT1HJhGy6djHw1n+6 ixIA== X-Forwarded-Encrypted: i=1; AJvYcCUfWvPkmFi16tDtMYvzLqZpy2x1Wl9+AJcsdlIMo/+gq5yI3iskKi4YqEHC64Wjr/XTYyMXLDA=@vger.kernel.org X-Gm-Message-State: AOJu0YyP11QRBqaNGiWBNbKcVeDatuGIcrFto0sCJTH6pcEvad5RFARm 7VrC5CDo5EfyjdVvuTIfQfeop6peq0ZDIf56fs3v4PCTDk2v4P+GRvM8GhEuhqDM4ylwzc+lp0h QZ3dT9ocivYJFpFt/B6nqopFyWABn6u8= X-Gm-Gg: ASbGncub+c7xQIMddKJkAv/kvJLsgxvB+xHXYOps178TK5TwWxnRXy9s26Cr8J8KE/C B+RHxdY+8UxNw92TQPCSMSpKCGKc36Y6/6IFjwm1a/s8RKM0Lbx4xW0YQMbsn045zQIR1e5WILp mOOmF5cf9r9x6azKH0/cjdAutE0XXdEkOpCCpa2AxBD27fx7MQZPENB7rqM5VNLAZylh5Uk+EHA ckfqCxFdFkeGotzeP8TSUXUrPCiUpzDgRti X-Google-Smtp-Source: AGHT+IHgo+WYjqQU4SsdvUGTS8UzFNwqRmcAAWsiHyknSHfsOn4aG616ucEJLt9ZJx34ZiYRNEWMbDb0/kmXi44bPmU= X-Received: by 2002:a17:90b:1d06:b0:32e:2c90:99a with SMTP id 98e67ed59e1d1-33b513b4b51mr35056966a91.35.1760421874366; Mon, 13 Oct 2025 23:04:34 -0700 (PDT) Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20251013134708.1270704-1-aha310510@gmail.com> <20251013164625.nphymwx25fde5eyk@pali> In-Reply-To: From: Jeongjun Park Date: Tue, 14 Oct 2025 15:04:23 +0900 X-Gm-Features: AS18NWCJ1qNnENzazf89-ZHRk0M4-ND7Pc4CWd_uJJpk98z55XLeWA5G4CpXXIk Message-ID: Subject: Re: [PATCH v3] exfat: fix out-of-bounds in exfat_nls_to_ucs2() To: Namjae Jeon Cc: =?UTF-8?Q?Pali_Roh=C3=A1r?= , Ethan Ferguson , Sungjong Seo , Yuezhang Mo , Al Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, syzbot+98cc76a76de46b3714d4@syzkaller.appspotmail.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: man7.org] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [aha310510[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 Hi Namjae, Namjae Jeon wrote: > > On Tue, Oct 14, 2025 at 1:46=E2=80=AFAM Pali Roh=C3=A1r = wrote: > > > > On Monday 13 October 2025 22:47:08 Jeongjun Park wrote: > > > Since the len argument value passed to exfat_ioctl_set_volume_label() > > > from exfat_nls_to_utf16() is passed 1 too large, an out-of-bounds rea= d > > > occurs when dereferencing p_cstring in exfat_nls_to_ucs2() later. > > > > > > And because of the NLS_NAME_OVERLEN macro, another error occurs when > > > creating a file with a period at the end using utf8 and other iochars= ets, > > > so the NLS_NAME_OVERLEN macro should be removed and the len argument = value > > > should be passed as FSLABEL_MAX - 1. > > > > > > Cc: > > > Reported-by: syzbot+98cc76a76de46b3714d4@syzkaller.appspotmail.com > > > Closes: https://syzkaller.appspot.com/bug?extid=3D98cc76a76de46b3714d= 4 > > > Fixes: 370e812b3ec1 ("exfat: add nls operations") > > > > Fixes: line is for sure wrong as the affected > > exfat_ioctl_set_volume_label function is not available in the mentioned > > commit. > > > > I guess it should be commit d01579d590f72d2d91405b708e96f6169f24775a. > > > > Now I have looked at that commit and I think I finally understood what > > was the issue. exfat_nls_to_utf16() function is written in a way that > > it expects null-term string and its strlen as 3rd argument. > > > > This was achieved for all code paths except the new one introduced in > > that commit. "label" is declared as char label[FSLABEL_MAX]; so the > > FSLABEL_MAX argument in exfat_nls_to_utf16() is effectively > > sizeof(label). And here comes the problem, it should have been > > strlen(label) (or rather strnlen(label, sizeof(label)-1) in case > > userspace pass non-nul term string). > > > > So the change below to FSLABEL_MAX - 1 effectively fix the overflow > > problem. But not the usage of exfat_nls_to_utf16. > > > > API of FS_IOC_SETFSLABEL is defined to always take nul-term string: > > https://man7.org/linux/man-pages/man2/fs_ioc_setfslabel.2const.html > > > > And size of buffer is not the length of nul-term string. We should > > discard anything after nul-term byte. > > > > So in my opinion exfat_ioctl_set_volume_label() should be fixed in a wa= y > > it would call exfat_nls_to_utf16() with 3rd argument passed as: > > > > strnlen(label, sizeof(label) - 1) > > > > or > > > > strnlen(label, FSLABEL_MAX - 1) > > > > Or personally I prefer to store this length into new variable (e.g. > > label_len) and then passing it to exfat_nls_to_utf16() function. > > For example: > > > > ret =3D exfat_nls_to_utf16(sb, label, label_len, &uniname, &lossy); > Right, I agree. > > > > Adding Ethan to CC as author of the mentioned commit. > > > > > > And about NLS_NAME_OVERLEN, it is being used by the > > __exfat_resolve_path() function. So removal of the "setting" of > > NLS_NAME_OVERLEN bit but still checking if the NLS_NAME_OVERLEN bit is > > set is quite wrong. > Right, The use of NLS_NAME_OVERLEN in __exfat_resolve_path() and > in the header should also be removed. I'll write a patch that reflects this analysis and send it to you right away. However, if do this, NLS_NAME_OVERLEN macro is no longer used anywhere in exfat, so does that mean should also remove the macro define itself? Regards, Jeongjun Park From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id cGKhLF6L7WgBYTQAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 23:29:34 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 23:29:34 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8Ryw-0000000FFmU-1aGq for hi@josie.lol; Mon, 13 Oct 2025 23:29:34 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 097C94E22DC for ; Mon, 13 Oct 2025 23:29:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E39E92D73AA; Mon, 13 Oct 2025 23:29:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AA2rzImz" X-Original-To: stable@vger.kernel.org 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 BEDF52C3761 for ; Mon, 13 Oct 2025 23:29:28 +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=1760398168; cv=none; b=DD0vly/dfwc6IdUUwLsNplmvJ1foVgU6sJv976Cpr5wvxKeBr9eISTgNs9yhIHwf91Who7JgxB+OzKpz3F2S6zqBKS7o8G1zaJ3Ij0CowJiZfk3IQTLVZp/LwsmqVgWH+kIwMy15uhy+aY9FplGSZuxhi4r4xA4Gxi2QYg5EqJw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760398168; c=relaxed/simple; bh=SQ0gWNpV8fChoEYMNhzwQKlfjtJr3sfa5X67jWtrJdY=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=malTdwWtEfQsPgtsGQXLFiZTDv4aVz2FbKudgobdZVISpYwhamZhVXSYwAtLMhrJIQgf0AErQMalF07AGH4ZoDVAmlOdLlmYTlT+zKs0P5Al5fdJJi6nH2lVYrbYqwmHg3ebZWCsg9ox3K8ID8vEeduzapBJv/dPaNJJcEi9bDI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AA2rzImz; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B5BDC19421 for ; Mon, 13 Oct 2025 23:29:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760398168; bh=SQ0gWNpV8fChoEYMNhzwQKlfjtJr3sfa5X67jWtrJdY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=AA2rzImzN90s32cp8e0uwxg8bh+IjSrBFwpjEddVpnqKHWTywbZioOr0J4+B2+ryR 6Vj65aj4/Jbxu5yjl8Tf3filr+PibU/tnHSjELxYuuqqhhgicq0E5yOHhTRhY9GhCa //C/BizcUv+ovNYskkqnpPRn7qXYGMtMin76zujrPEvJsYEE2CAu1GZUx1XkGtDm7D rLlyd9sW1z+Ura6VViHuNKRkQqEf/6aU6qYqQ9loMmIZmUZpad8P+7l13LaYhnHco4 swGL1cA6UGnaJbyJhluocGtxILsD0r89J/6htBaI/ycF9tu1yGeolAqfbhk3WUbTxq O/kaCYjnm3V3Q== Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-b3f5e0e2bf7so882794966b.3 for ; Mon, 13 Oct 2025 16:29:28 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCXo4MFZo2PLfsJtke2/Ux55/UcL3r98soKhu9Otd1EXCwYRGA6yld2DAlB54C42yg1a7xYmxtY=@vger.kernel.org X-Gm-Message-State: AOJu0YwLS7feEPMDLcO7SfB+38VQ0wQDKtajnMdQxG55G3rbq4lJIgqM OnupQc0y+RiGywj0nyrE00q3bt5YbCah/p3lQc7CS69uBwu1MsdLQuriBxg25E+QuJT9g7v74Z+ qhR77vafGiXZy+kJ4SMjX0X56PCfTpww= X-Google-Smtp-Source: AGHT+IGKMgfNlTuVRjrvwrgGu5wAUKAOzjA5+Qj4nhVCZNyzu4FakDZO2A4HdYX7LTuYYFd1tWuBIeotI0oHcIElStI= X-Received: by 2002:a17:907:971e:b0:b4c:1ad1:d08c with SMTP id a640c23a62f3a-b50aa393b8amr2537644866b.17.1760398166753; Mon, 13 Oct 2025 16:29:26 -0700 (PDT) Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20251013134708.1270704-1-aha310510@gmail.com> <20251013164625.nphymwx25fde5eyk@pali> In-Reply-To: <20251013164625.nphymwx25fde5eyk@pali> From: Namjae Jeon Date: Tue, 14 Oct 2025 08:29:14 +0900 X-Gmail-Original-Message-ID: X-Gm-Features: AS18NWA2a1YxuJIOARSQtQYwyd5cLkP4zCGhLc1g0fsPOO2REg4pII5pSv2KDSU Message-ID: Subject: Re: [PATCH v3] exfat: fix out-of-bounds in exfat_nls_to_ucs2() To: =?UTF-8?Q?Pali_Roh=C3=A1r?= Cc: Jeongjun Park , Ethan Ferguson , Sungjong Seo , Yuezhang Mo , Al Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, syzbot+98cc76a76de46b3714d4@syzkaller.appspotmail.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.2 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.2 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: man7.org] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -11 On Tue, Oct 14, 2025 at 1:46=E2=80=AFAM Pali Roh=C3=A1r w= rote: > > On Monday 13 October 2025 22:47:08 Jeongjun Park wrote: > > Since the len argument value passed to exfat_ioctl_set_volume_label() > > from exfat_nls_to_utf16() is passed 1 too large, an out-of-bounds read > > occurs when dereferencing p_cstring in exfat_nls_to_ucs2() later. > > > > And because of the NLS_NAME_OVERLEN macro, another error occurs when > > creating a file with a period at the end using utf8 and other iocharset= s, > > so the NLS_NAME_OVERLEN macro should be removed and the len argument va= lue > > should be passed as FSLABEL_MAX - 1. > > > > Cc: > > Reported-by: syzbot+98cc76a76de46b3714d4@syzkaller.appspotmail.com > > Closes: https://syzkaller.appspot.com/bug?extid=3D98cc76a76de46b3714d4 > > Fixes: 370e812b3ec1 ("exfat: add nls operations") > > Fixes: line is for sure wrong as the affected > exfat_ioctl_set_volume_label function is not available in the mentioned > commit. > > I guess it should be commit d01579d590f72d2d91405b708e96f6169f24775a. > > Now I have looked at that commit and I think I finally understood what > was the issue. exfat_nls_to_utf16() function is written in a way that > it expects null-term string and its strlen as 3rd argument. > > This was achieved for all code paths except the new one introduced in > that commit. "label" is declared as char label[FSLABEL_MAX]; so the > FSLABEL_MAX argument in exfat_nls_to_utf16() is effectively > sizeof(label). And here comes the problem, it should have been > strlen(label) (or rather strnlen(label, sizeof(label)-1) in case > userspace pass non-nul term string). > > So the change below to FSLABEL_MAX - 1 effectively fix the overflow > problem. But not the usage of exfat_nls_to_utf16. > > API of FS_IOC_SETFSLABEL is defined to always take nul-term string: > https://man7.org/linux/man-pages/man2/fs_ioc_setfslabel.2const.html > > And size of buffer is not the length of nul-term string. We should > discard anything after nul-term byte. > > So in my opinion exfat_ioctl_set_volume_label() should be fixed in a way > it would call exfat_nls_to_utf16() with 3rd argument passed as: > > strnlen(label, sizeof(label) - 1) > > or > > strnlen(label, FSLABEL_MAX - 1) > > Or personally I prefer to store this length into new variable (e.g. > label_len) and then passing it to exfat_nls_to_utf16() function. > For example: > > ret =3D exfat_nls_to_utf16(sb, label, label_len, &uniname, &lossy); Right, I agree. > > Adding Ethan to CC as author of the mentioned commit. > > > And about NLS_NAME_OVERLEN, it is being used by the > __exfat_resolve_path() function. So removal of the "setting" of > NLS_NAME_OVERLEN bit but still checking if the NLS_NAME_OVERLEN bit is > set is quite wrong. Right, The use of NLS_NAME_OVERLEN in __exfat_resolve_path() and in the header should also be removed. > > > Namjae, could you re-check my analysis? Just to be sure that I have not > misunderstood something. It is better to do proper analysis than having > incomplete or incorrect fix. Yes, I agree with your analysis. Thanks! > > > Signed-off-by: Jeongjun Park > > --- > > fs/exfat/file.c | 2 +- > > fs/exfat/nls.c | 3 --- > > 2 files changed, 1 insertion(+), 4 deletions(-) > > > > diff --git a/fs/exfat/file.c b/fs/exfat/file.c > > index f246cf439588..7ce0fb6f2564 100644 > > --- a/fs/exfat/file.c > > +++ b/fs/exfat/file.c > > @@ -521,7 +521,7 @@ static int exfat_ioctl_set_volume_label(struct supe= r_block *sb, > > > > memset(&uniname, 0, sizeof(uniname)); > > if (label[0]) { > > - ret =3D exfat_nls_to_utf16(sb, label, FSLABEL_MAX, > > + ret =3D exfat_nls_to_utf16(sb, label, FSLABEL_MAX - 1, > > &uniname, &lossy); > > if (ret < 0) > > return ret; > > diff --git a/fs/exfat/nls.c b/fs/exfat/nls.c > > index 8243d94ceaf4..57db08a5271c 100644 > > --- a/fs/exfat/nls.c > > +++ b/fs/exfat/nls.c > > @@ -616,9 +616,6 @@ static int exfat_nls_to_ucs2(struct super_block *sb= , > > unilen++; > > } > > > > - if (p_cstring[i] !=3D '\0') > > - lossy |=3D NLS_NAME_OVERLEN; > > - > > *uniname =3D '\0'; > > p_uniname->name_len =3D unilen; > > p_uniname->name_hash =3D exfat_calc_chksum16(upname, unilen << 1,= 0, > > -- From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id uOpgEFwv7WiOzwUAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 16:57:00 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 16:57:00 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8Lr1-00000001wrd-45jK for hi@josie.lol; Mon, 13 Oct 2025 16:57:00 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id C7EEE4F8305 for ; Mon, 13 Oct 2025 16:46:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EBCEF27978C; Mon, 13 Oct 2025 16:46:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AnszU/S7" X-Original-To: stable@vger.kernel.org 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 AABE8274FDC; Mon, 13 Oct 2025 16:46:30 +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=1760373990; cv=none; b=pQvahoSDFRohJmq6pG7o0jMsiAh1yOid4Av3Ed9KQrDMCYxBhN55JHAz0wVXo80yPgyO0lH3+xWfM9VLO2tP1jfNDv6UyzXM3y8f2AWcwqHRrpvcxa/XSwYZzzE5w5aXLTPPpmsv5C1VMmNxzbN3cHJuI5jYh4r39ue86kJr8NE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760373990; c=relaxed/simple; bh=gxIAqG/scBYhaZ9vj8aZdm7V+FHB+EsklZHcQAKBPOk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lnQWTqGAET5CIkRfbMZ3rFytC/MZWGMLQ3kkSoBZD89KODCPAzo7KDqo21Oliztf09eN6Ygb6rfWCqIOMy2Ir7iXeOEtimo1nLkp0Jf4VDiMCw6b0k4mzw9gmeA/tDyO5hS2ebBmOZdr7fR10DmRuyo1+uElHoQRbHTUOX6/fBo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AnszU/S7; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9AE2C4CEE7; Mon, 13 Oct 2025 16:46:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760373990; bh=gxIAqG/scBYhaZ9vj8aZdm7V+FHB+EsklZHcQAKBPOk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AnszU/S7VE+pxvk0IH9dd5U0qkT8N8joHyVjE82lE/plX3e3CfS/Xm9A02sDh/wBx C7QYWmmCelZcepG6eZBbKZBooStQh0zZbsgAw4t0EdDp+Gqtuq4tIUOD0eENrTNRM/ vzfD7FNcIgv1rBxd+bJDr7+WzUEJGXwz41JZH3vaONX0Us+v+Igo7e0ZG8UwIZaWoj cZaApewlNompuIP9AxxxJllMUzi/YxMAfCLT4C36KgrP0th97BuvCAnHVdQ9OynHoB nftgE28RWKMhCJbF6hrF9wwscZWwPD9XBk4ugm4+RFG8el1mn3gEE0UFEVKrnSxCMN ZLXAneyglfehQ== Received: by pali.im (Postfix) id 787D5788; Mon, 13 Oct 2025 18:46:25 +0200 (CEST) Date: Mon, 13 Oct 2025 18:46:25 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Jeongjun Park Cc: Ethan Ferguson , Namjae Jeon , Sungjong Seo , Yuezhang Mo , Al Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, syzbot+98cc76a76de46b3714d4@syzkaller.appspotmail.com Subject: Re: [PATCH v3] exfat: fix out-of-bounds in exfat_nls_to_ucs2() Message-ID: <20251013164625.nphymwx25fde5eyk@pali> References: <20251013134708.1270704-1-aha310510@gmail.com> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251013134708.1270704-1-aha310510@gmail.com> User-Agent: NeoMutt/20180716 X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.2 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.2 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: man7.org] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -11 On Monday 13 October 2025 22:47:08 Jeongjun Park wrote: > Since the len argument value passed to exfat_ioctl_set_volume_label() > from exfat_nls_to_utf16() is passed 1 too large, an out-of-bounds read > occurs when dereferencing p_cstring in exfat_nls_to_ucs2() later. > > And because of the NLS_NAME_OVERLEN macro, another error occurs when > creating a file with a period at the end using utf8 and other iocharsets, > so the NLS_NAME_OVERLEN macro should be removed and the len argument value > should be passed as FSLABEL_MAX - 1. > > Cc: > Reported-by: syzbot+98cc76a76de46b3714d4@syzkaller.appspotmail.com > Closes: https://syzkaller.appspot.com/bug?extid=98cc76a76de46b3714d4 > Fixes: 370e812b3ec1 ("exfat: add nls operations") Fixes: line is for sure wrong as the affected exfat_ioctl_set_volume_label function is not available in the mentioned commit. I guess it should be commit d01579d590f72d2d91405b708e96f6169f24775a. Now I have looked at that commit and I think I finally understood what was the issue. exfat_nls_to_utf16() function is written in a way that it expects null-term string and its strlen as 3rd argument. This was achieved for all code paths except the new one introduced in that commit. "label" is declared as char label[FSLABEL_MAX]; so the FSLABEL_MAX argument in exfat_nls_to_utf16() is effectively sizeof(label). And here comes the problem, it should have been strlen(label) (or rather strnlen(label, sizeof(label)-1) in case userspace pass non-nul term string). So the change below to FSLABEL_MAX - 1 effectively fix the overflow problem. But not the usage of exfat_nls_to_utf16. API of FS_IOC_SETFSLABEL is defined to always take nul-term string: https://man7.org/linux/man-pages/man2/fs_ioc_setfslabel.2const.html And size of buffer is not the length of nul-term string. We should discard anything after nul-term byte. So in my opinion exfat_ioctl_set_volume_label() should be fixed in a way it would call exfat_nls_to_utf16() with 3rd argument passed as: strnlen(label, sizeof(label) - 1) or strnlen(label, FSLABEL_MAX - 1) Or personally I prefer to store this length into new variable (e.g. label_len) and then passing it to exfat_nls_to_utf16() function. For example: ret = exfat_nls_to_utf16(sb, label, label_len, &uniname, &lossy); Adding Ethan to CC as author of the mentioned commit. And about NLS_NAME_OVERLEN, it is being used by the __exfat_resolve_path() function. So removal of the "setting" of NLS_NAME_OVERLEN bit but still checking if the NLS_NAME_OVERLEN bit is set is quite wrong. Namjae, could you re-check my analysis? Just to be sure that I have not misunderstood something. It is better to do proper analysis than having incomplete or incorrect fix. > Signed-off-by: Jeongjun Park > --- > fs/exfat/file.c | 2 +- > fs/exfat/nls.c | 3 --- > 2 files changed, 1 insertion(+), 4 deletions(-) > > diff --git a/fs/exfat/file.c b/fs/exfat/file.c > index f246cf439588..7ce0fb6f2564 100644 > --- a/fs/exfat/file.c > +++ b/fs/exfat/file.c > @@ -521,7 +521,7 @@ static int exfat_ioctl_set_volume_label(struct super_block *sb, > > memset(&uniname, 0, sizeof(uniname)); > if (label[0]) { > - ret = exfat_nls_to_utf16(sb, label, FSLABEL_MAX, > + ret = exfat_nls_to_utf16(sb, label, FSLABEL_MAX - 1, > &uniname, &lossy); > if (ret < 0) > return ret; > diff --git a/fs/exfat/nls.c b/fs/exfat/nls.c > index 8243d94ceaf4..57db08a5271c 100644 > --- a/fs/exfat/nls.c > +++ b/fs/exfat/nls.c > @@ -616,9 +616,6 @@ static int exfat_nls_to_ucs2(struct super_block *sb, > unilen++; > } > > - if (p_cstring[i] != '\0') > - lossy |= NLS_NAME_OVERLEN; > - > *uniname = '\0'; > p_uniname->name_len = unilen; > p_uniname->name_hash = exfat_calc_chksum16(upname, unilen << 1, 0, > -- From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id +AmKHvsC7Wi1rCwAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 13:47:39 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 13:47:39 +0000 Received: from ams.mirrors.kernel.org ([213.196.21.55]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8Itn-0000000CokF-0lkj for hi@josie.lol; Mon, 13 Oct 2025 13:47:39 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.mirrors.kernel.org (Postfix) with ESMTPS id F095F34C6AD for ; Mon, 13 Oct 2025 13:47:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F2B4E1E8332; Mon, 13 Oct 2025 13:47:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="io1hlNIi" X-Original-To: stable@vger.kernel.org Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 700AE1F4C96 for ; Mon, 13 Oct 2025 13:47:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760363248; cv=none; b=sZ0JBDzFzoyzpS8MJ22nsJSUpsn5FnxyJU4JRDx9u05xV8f+LcCY/X0ov4Anvfsl7k7p+yqx95UBINUY+7SbyblADpV5F7HDwdc++yp5nR8o5swm/uKRQNgdMW1oXMGUzQEPnpXtHIPJeUb8aA8ZlAWMFErqVADc6K46ohPAaoc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760363248; c=relaxed/simple; bh=Swp4+xHTqvgYr+z64DMuU57MVlL3j0v8jDSlSv8/1Rs=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=pEqDcC3MLD94YiBkbP6IV85ehn2DC8+2hM2TrCZyEQ88blCCOclfHoAm+PA5u3gBBDcHg13LH0ykF8T/SGuYmmKb6A5AkFsPFtGIZ8AiuOSZEvL7i+4H/2QP3OrHyCFh0S6P1YyOdI2QXwvqJ6qWDqXwNEd7njQauiiLS2c5y3c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=io1hlNIi; arc=none smtp.client-ip=209.85.210.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-781db5068b8so3398476b3a.0 for ; Mon, 13 Oct 2025 06:47:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760363247; x=1760968047; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=teOPnCrlstkFyH9+vuIz1dE4A6eVshfJueJ5oAZ3QHs=; b=io1hlNIiVqXlc1wjOO1Rak6dG0PCmd87m6yKf7aSc0mEZV0nxR+OmHBUv4xbgPmchU UT+ohTXQGkOWgu7RQUvjFsuw3jx95XXtFJj20VylppMWy9L9VAsDDkBiNpYVMusvyQ3o 5wjdI0ZxwK366brx/sQD+9O8TEEWQm7k3m7aFlh6Nc3UJ0aqRWHBeoXzgROm4kJ/VXaI 3pp5GEfkHcyzG+rdmiiYdmYN4N9F+SvKTQaUK/x/f4/7Fajd7S3IkP6Zi9AcdDIoz+tV 1+5p1fKcdPVgXYtm6+w3qn6va/Hm+qiv9MFZnQXvkRaD0TGc+zOt81ZvR423VgKgR1Xu jzOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760363247; x=1760968047; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=teOPnCrlstkFyH9+vuIz1dE4A6eVshfJueJ5oAZ3QHs=; b=JMo5IDmc9Bp3GpSFbWukkWYV7Nl84ZpCYin7qNAr9wog2iBWHb4yrJcHcnRcrRRB8+ qTkFijKds2lEJ1C2BB4sndhhXErsxDiAb2SvJUD9WDFCcsBZalzL3ABPdXgvmeDadQJl DCjJ1QE26O2yVBMxmVIZQzW6XLHzROwPsxmL1l97GnfkNMBp3rnqkObkNCA/gY9UxVSP 3qt3Hp+4gi2Fr5U33bCZxCNw+yTeynUCiUtFFGdnjPEjgpE0PrHkRqLyip+UBfyBXARk zUwg0cE+1BTdioLajte6NabSBym1oBRivZKbcJtXmmR9cMwJAQMBKCCHkxsdBS2od7k4 pjiQ== X-Forwarded-Encrypted: i=1; AJvYcCW6ILaZahlTKwX3WUzB53PXApyJ0VbO8aCvaIgI+5wUP1pz6hYB0AjkalS4rcQzvLgK7twiG+8=@vger.kernel.org X-Gm-Message-State: AOJu0Yz6IqnLDujErucD7YhjNBnlZSOb/m9OgSdQy0zPX8Ga+755xSn9 IojN3LwzcvwJcKpAHAUgY5/fcVkvZGRb89nO3pfXRPr4dBIViTYXwfAfLanLDMeg X-Gm-Gg: ASbGncvz3pyIaI2jWREEVlNDh4djLyWbBCxnT7mSqlhp234B7IgWJknfasot4ZxR/G+ eL7OQwCcGcnh95ncWq+iodIWiqhZzP3JUtnZtRizAWSW7/rRpZi+IhzZRiMDYMD85ckra9ArXY3 p6j3oRMVI8aPJsMSOUysp+Ddkv4pe1hSnj2u2ZNgxuvCc+yn9HWfKZ0iuCXeARSVpSrUvszi/Vd ExtaT+jfiRnO41A4DiSlBYD4XlSjIV2BAGvKvQglJtUlMPQd8WjIh5ZX5Ls1IlkI3kf2C0YwUnM t7YWB2xYsyCjy+JnHIwSnUrFsIEghaNnJ6Diy6suJIl95yJ+l1fhiTQDCsMyXSdpcr7niKZ+Yhr MuddA7rkblkXR/xqC/9R5EQUPwZawURHnRzHaTBNKc1C6w80kcCMiCjtIE9r4OBxvIGgv X-Google-Smtp-Source: AGHT+IFD9xM53HQ+bQQDPEQgAUdL3IwH91zz8prxo1co6ZEPN18n39S7OZmUBWp8Eqf4/zWeSLysJQ== X-Received: by 2002:a17:90b:1d06:b0:32e:2c90:99a with SMTP id 98e67ed59e1d1-33b513b4b51mr31706554a91.35.1760363246720; Mon, 13 Oct 2025 06:47:26 -0700 (PDT) Received: from name2965-Precision-7820-Tower.. ([121.185.186.233]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-33b626d61aasm12295067a91.17.2025.10.13.06.47.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Oct 2025 06:47:26 -0700 (PDT) From: Jeongjun Park To: Namjae Jeon , Sungjong Seo Cc: Yuezhang Mo , Al Viro , pali@kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, syzbot+98cc76a76de46b3714d4@syzkaller.appspotmail.com, Jeongjun Park Subject: [PATCH v3] exfat: fix out-of-bounds in exfat_nls_to_ucs2() Date: Mon, 13 Oct 2025 22:47:08 +0900 Message-Id: <20251013134708.1270704-1-aha310510@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: syzkaller.appspot.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [213.196.21.55 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [aha310510[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 Since the len argument value passed to exfat_ioctl_set_volume_label() from exfat_nls_to_utf16() is passed 1 too large, an out-of-bounds read occurs when dereferencing p_cstring in exfat_nls_to_ucs2() later. And because of the NLS_NAME_OVERLEN macro, another error occurs when creating a file with a period at the end using utf8 and other iocharsets, so the NLS_NAME_OVERLEN macro should be removed and the len argument value should be passed as FSLABEL_MAX - 1. Cc: Reported-by: syzbot+98cc76a76de46b3714d4@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=98cc76a76de46b3714d4 Fixes: 370e812b3ec1 ("exfat: add nls operations") Signed-off-by: Jeongjun Park --- fs/exfat/file.c | 2 +- fs/exfat/nls.c | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/fs/exfat/file.c b/fs/exfat/file.c index f246cf439588..7ce0fb6f2564 100644 --- a/fs/exfat/file.c +++ b/fs/exfat/file.c @@ -521,7 +521,7 @@ static int exfat_ioctl_set_volume_label(struct super_block *sb, memset(&uniname, 0, sizeof(uniname)); if (label[0]) { - ret = exfat_nls_to_utf16(sb, label, FSLABEL_MAX, + ret = exfat_nls_to_utf16(sb, label, FSLABEL_MAX - 1, &uniname, &lossy); if (ret < 0) return ret; diff --git a/fs/exfat/nls.c b/fs/exfat/nls.c index 8243d94ceaf4..57db08a5271c 100644 --- a/fs/exfat/nls.c +++ b/fs/exfat/nls.c @@ -616,9 +616,6 @@ static int exfat_nls_to_ucs2(struct super_block *sb, unilen++; } - if (p_cstring[i] != '\0') - lossy |= NLS_NAME_OVERLEN; - *uniname = '\0'; p_uniname->name_len = unilen; p_uniname->name_hash = exfat_calc_chksum16(upname, unilen << 1, 0, -- From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id KJPsG0n+7WgOkCsAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 07:39:53 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 07:39:53 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8ZdQ-0000000De0V-2jsZ for hi@josie.lol; Tue, 14 Oct 2025 07:39:53 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 63A7A18A31BF for ; Tue, 14 Oct 2025 07:40:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 89E2A23CE; Tue, 14 Oct 2025 07:39:48 +0000 (UTC) X-Original-To: stable@vger.kernel.org Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D43C429BD81; Tue, 14 Oct 2025 07:39:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760427588; cv=none; b=CMGJcEVxAxb/L8Y76nbY22mLhcu9uW5RpYfiEtWjT7apOuKj88YBvj6V/njrZCNIy+cUnZGVOq8z4hvA4mI2wCNbK0LNcY7+NAdM1qz23dJZCkoKeYiGhe/esxCAvZo8kYOQ1gclLaFobbJ6Q9mNDd2A+0inMN0ZrH47hlkD1To= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760427588; c=relaxed/simple; bh=BQ9jer1zGLwz8HVUVnXNwihqaOBybFGc85+G5DL43uQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=sstp+Z3vwLncn3DdWZx/RYUo6Yk164+QKV4YsPZeVgZOeXAOCyMlZ3D8neKH9BT6YYEcpfGscvKbwypzb9P2uxvprJ/x3yL3TP4lKnJZ4nm63bOV2QVMm16VOETJGtyi+xnkjTLr60p9LDbW6fxYyIE40wJn3HQqpqvyqSVZ8os= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [223.64.68.198]) by gateway (Coremail) with SMTP id _____8CxK9I+_u1opesVAA--.45392S3; Tue, 14 Oct 2025 15:39:42 +0800 (CST) Received: from localhost.localdomain (unknown [223.64.68.198]) by front1 (Coremail) with SMTP id qMiowJDxscI5_u1oWivhAA--.63490S2; Tue, 14 Oct 2025 15:39:41 +0800 (CST) From: Huacai Chen To: Bjorn Helgaas , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Rob Herring Cc: linux-pci@vger.kernel.org, Jianmin Lv , Xuefeng Li , Huacai Chen , Jiaxun Yang , Huacai Chen , stable@vger.kernel.org Subject: [PATCH 03/15] PCI: Limit islolated function probing on bus 0 for LoongArch Date: Tue, 14 Oct 2025 15:39:29 +0800 Message-ID: <20251014073929.2143907-1-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.47.3 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:qMiowJDxscI5_u1oWivhAA--.63490S2 X-CM-SenderInfo: hfkh0x5xdftxo6or00hjvr0hdfq/ X-Coremail-Antispam: 1Uk129KBj93XoWxJry8Cr43tF1DZFyxAFyxWFX_yoW8Ww18pF Z5u3y8Ary8KFy3ArZxA3y0kr15K397A34UCFWUG345XanxJ3Wxtws8tF1aqrnrGrWIvFyF qa1DZrW5u3WxA3gCm3ZEXasCq-sJn29KB7ZKAUJUUUU7529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUvEb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Cr0_Gr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6rxl6s0DM2kKe7AKxVWUXVWUAwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYI kI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUAVWU twAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI4 8JMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMxCIbckI1I0E14v26r1Y 6r17MI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7 AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE 2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcV C2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73 UjIFyTuYvjxUc0eHDUUUU X-Spam-Score: -1.8 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.8 points) --- pts rule name description ---- ---------------------- ----------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [147.75.80.249 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: -17 We found some discrete AMD graphics devices hide funtion 0 and the whole is not supposed to be probed. Since our original purpose is to allow integrated devices (on bus 0) to be probed without function 0, we can limit the islolated function probing only on bus 0. Cc: stable@vger.kernel.org Fixes: a02fd05661d73a8 ("PCI: Extend isolated function probing to LoongArch") Signed-off-by: Huacai Chen --- drivers/pci/probe.c | 2 +- include/linux/hypervisor.h | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index c83e75a0ec12..da6a2aef823a 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -2883,7 +2883,7 @@ int pci_scan_slot(struct pci_bus *bus, int devfn) * a hypervisor that passes through individual PCI * functions. */ - if (!hypervisor_isolated_pci_functions()) + if (!hypervisor_isolated_pci_functions(bus->number)) break; } fn = next_fn(bus, dev, fn); diff --git a/include/linux/hypervisor.h b/include/linux/hypervisor.h index be5417303ecf..30ece04a16d9 100644 --- a/include/linux/hypervisor.h +++ b/include/linux/hypervisor.h @@ -32,13 +32,15 @@ static inline bool jailhouse_paravirt(void) #endif /* !CONFIG_X86 */ -static inline bool hypervisor_isolated_pci_functions(void) +static inline bool hypervisor_isolated_pci_functions(int bus) { if (IS_ENABLED(CONFIG_S390)) return true; - if (IS_ENABLED(CONFIG_LOONGARCH)) - return true; + if (IS_ENABLED(CONFIG_LOONGARCH)) { + if (bus == 0) + return true; + } return jailhouse_paravirt(); } -- 2.47.3 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id uLYsKMsK7mjGSSkAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 08:33:15 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 08:33:15 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8aT5-0000000FW1S-0YZr for hi@josie.lol; Tue, 14 Oct 2025 08:33:15 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 84081189F6F4 for ; Tue, 14 Oct 2025 08:33:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A438E2DCF5B; Tue, 14 Oct 2025 08:33:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="abchEqRI"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="EAXB2LYk"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="abchEqRI"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="EAXB2LYk" X-Original-To: stable@vger.kernel.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 974902C15BA for ; Tue, 14 Oct 2025 08:33:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760430790; cv=none; b=NiQjsGhNEy7Shgf1hIi5klKSPsICfw55ZUL0voamWUWPnAslyi0MZ2uSoNC+V7tcranakesPFNKkwEJ+uycvylXWl2dKZ6FCY2U5K/Jz6GYQRBSAAhc1bLuFXa5Osq3Rb7i0ntI5q9Jtth3ug80MDWszwZ1NXjYSbMfR9P5coIo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760430790; c=relaxed/simple; bh=/WJNpu+xN3EV8b6l1tPPmU4I6w1IRlz56n2WBQCumAE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=qMxX6Q+X94q7qRlTtNk95ggqguzyc78pww5TIK9qYIS5BWuebmjFKFZmGjzGTztCoXcBTZbXIN0KKezNBP0UMZ9XU/AEzagNcOdfCn3mm30RY3V/kgXC7V0amVLZ490LXChdfAMX6nShKQBZ4lynbvQpKe+qkNxu5nSBv3QbNgk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=abchEqRI; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=EAXB2LYk; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=abchEqRI; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=EAXB2LYk; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 96BC821D8C; Tue, 14 Oct 2025 08:33:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1760430786; h=from:from:reply-to: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:autocrypt:autocrypt; bh=aJbGhNs7yXqCu2TM4PLIzCVg37upHDVrwG0JVA1aymg=; b=abchEqRIqQt96fuRv+5tL106tzwSHXgPV2kjdFP1NoExc8i01hpwoqbDdLdzy/fs9ZvgYx gHgwva3UWw1i8O7dxZAuplbSntk+KM7+uKvPAueZfZYBnUbdBAxpAZJhQ4mzOhgzsN6+7P D1+fVNgobcSMnCmErqAZH4HWy+FWMAM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1760430786; h=from:from:reply-to: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:autocrypt:autocrypt; bh=aJbGhNs7yXqCu2TM4PLIzCVg37upHDVrwG0JVA1aymg=; b=EAXB2LYk8dqTO4RysRaTLZjJl+tZT4XTnhR4QjSda/AsqTteXCdM4Toi/QDajDebLrarWb qE46o/+/Dp1NLQBg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=abchEqRI; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=EAXB2LYk DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1760430786; h=from:from:reply-to: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:autocrypt:autocrypt; bh=aJbGhNs7yXqCu2TM4PLIzCVg37upHDVrwG0JVA1aymg=; b=abchEqRIqQt96fuRv+5tL106tzwSHXgPV2kjdFP1NoExc8i01hpwoqbDdLdzy/fs9ZvgYx gHgwva3UWw1i8O7dxZAuplbSntk+KM7+uKvPAueZfZYBnUbdBAxpAZJhQ4mzOhgzsN6+7P D1+fVNgobcSMnCmErqAZH4HWy+FWMAM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1760430786; h=from:from:reply-to: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:autocrypt:autocrypt; bh=aJbGhNs7yXqCu2TM4PLIzCVg37upHDVrwG0JVA1aymg=; b=EAXB2LYk8dqTO4RysRaTLZjJl+tZT4XTnhR4QjSda/AsqTteXCdM4Toi/QDajDebLrarWb qE46o/+/Dp1NLQBg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 612AC13A44; Tue, 14 Oct 2025 08:33:06 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id PE9NFsIK7mhFGAAAD6G6ig (envelope-from ); Tue, 14 Oct 2025 08:33:06 +0000 Message-ID: <404d4ac2-6227-400d-8031-f15b7274258f@suse.de> Date: Tue, 14 Oct 2025 10:33:05 +0200 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] drm/ast: Blank with VGACR17 sync enable, always clear VGACRB6 sync off To: Jocelyn Falempe , airlied@redhat.com, dianders@chromium.org, nbowler@draconx.ca Cc: dri-devel@lists.freedesktop.org, stable@vger.kernel.org References: <20251010080233.21771-1-tzimmermann@suse.de> <9ad17cb1-3e09-4082-b52b-0b218812f114@redhat.com> Content-Language: en-US From: Thomas Zimmermann Autocrypt: addr=tzimmermann@suse.de; keydata= xsBNBFs50uABCADEHPidWt974CaxBVbrIBwqcq/WURinJ3+2WlIrKWspiP83vfZKaXhFYsdg XH47fDVbPPj+d6tQrw5lPQCyqjwrCPYnq3WlIBnGPJ4/jreTL6V+qfKRDlGLWFjZcsrPJGE0 BeB5BbqP5erN1qylK9i3gPoQjXGhpBpQYwRrEyQyjuvk+Ev0K1Jc5tVDeJAuau3TGNgah4Yc hdHm3bkPjz9EErV85RwvImQ1dptvx6s7xzwXTgGAsaYZsL8WCwDaTuqFa1d1jjlaxg6+tZsB 9GluwvIhSezPgnEmimZDkGnZRRSFiGP8yjqTjjWuf0bSj5rUnTGiyLyRZRNGcXmu6hjlABEB AAHNJ1Rob21hcyBaaW1tZXJtYW5uIDx0emltbWVybWFubkBzdXNlLmRlPsLAjgQTAQgAOAIb AwULCQgHAgYVCgkICwIEFgIDAQIeAQIXgBYhBHIX+6yM6c9jRKFo5WgNwR1TC3ojBQJftODH AAoJEGgNwR1TC3ojx1wH/0hKGWugiqDgLNXLRD/4TfHBEKmxIrmfu9Z5t7vwUKfwhFL6hqvo lXPJJKQpQ2z8+X2vZm/slsLn7J1yjrOsoJhKABDi+3QWWSGkaGwRJAdPVVyJMfJRNNNIKwVb U6B1BkX2XDKDGffF4TxlOpSQzdtNI/9gleOoUA8+jy8knnDYzjBNOZqLG2FuTdicBXblz0Mf vg41gd9kCwYXDnD91rJU8tzylXv03E75NCaTxTM+FBXPmsAVYQ4GYhhgFt8S2UWMoaaABLDe 7l5FdnLdDEcbmd8uLU2CaG4W2cLrUaI4jz2XbkcPQkqTQ3EB67hYkjiEE6Zy3ggOitiQGcqp j//OwE0EWznS4AEIAMYmP4M/V+T5RY5at/g7rUdNsLhWv1APYrh9RQefODYHrNRHUE9eosYb T6XMryR9hT8XlGOYRwKWwiQBoWSDiTMo/Xi29jUnn4BXfI2px2DTXwc22LKtLAgTRjP+qbU6 3Y0xnQN29UGDbYgyyK51DW3H0If2a3JNsheAAK+Xc9baj0LGIc8T9uiEWHBnCH+RdhgATnWW GKdDegUR5BkDfDg5O/FISymJBHx2Dyoklv5g4BzkgqTqwmaYzsl8UxZKvbaxq0zbehDda8lv hFXodNFMAgTLJlLuDYOGLK2AwbrS3Sp0AEbkpdJBb44qVlGm5bApZouHeJ/+n+7r12+lqdsA EQEAAcLAdgQYAQgAIAIbDBYhBHIX+6yM6c9jRKFo5WgNwR1TC3ojBQJftOH6AAoJEGgNwR1T C3ojVSkIALpAPkIJPQoURPb1VWjh34l0HlglmYHvZszJWTXYwavHR8+k6Baa6H7ufXNQtThR yIxJrQLW6rV5lm7TjhffEhxVCn37+cg0zZ3j7zIsSS0rx/aMwi6VhFJA5hfn3T0TtrijKP4A SAQO9xD1Zk9/61JWk8OysuIh7MXkl0fxbRKWE93XeQBhIJHQfnc+YBLprdnxR446Sh8Wn/2D Ya8cavuWf2zrB6cZurs048xe0UbSW5AOSo4V9M0jzYI4nZqTmPxYyXbm30Kvmz0rYVRaitYJ 4kyYYMhuULvrJDMjZRvaNe52tkKAvMevcGdt38H4KSVXAylqyQOW5zvPc4/sq9c= In-Reply-To: <9ad17cb1-3e09-4082-b52b-0b218812f114@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 96BC821D8C X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MID_RHS_MATCH_FROM(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:mid,suse.de:dkim,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Spam-Flag: NO X-Spam-Score: -4.51 X-Spam-Level: X-DKIM: signer='suse.de' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: suse.de] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.80.249 listed in list.dnswl.org] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 Hi Am 14.10.25 um 09:45 schrieb Jocelyn Falempe: > On 10/10/2025 10:02, Thomas Zimmermann wrote: >> Blank the display by disabling sync pulses with VGACR17<7>. Unblank >> by reenabling them. This VGA setting should be supported by all Aspeed >> hardware. >> >> Ast currently blanks via sync-off bits in VGACRB6. Not all BMCs handle >> VGACRB6 correctly. After disabling sync during a reboot, some BMCs do >> not reenable it after the soft reset. The display output remains dark. >> When the display is off during boot, some BMCs set the sync-off bits in >> VGACRB6, so the display remains dark. Observed with Blackbird AST2500 >> BMC. Clearing the sync-off bits unconditionally fixes these issues. >> >> Also do not modify VGASR1's SD bit for blanking, as it only disables GPU >> access to video memory. > > One comment below:> >> Signed-off-by: Thomas Zimmermann >> Fixes: ce3d99c83495 ("drm: Call drm_atomic_helper_shutdown() at >> shutdown time for misc drivers") >> Tested-by: Nick Bowler >> Reported-by: Nick Bowler >> Closes: >> https://lore.kernel.org/dri-devel/wpwd7rit6t4mnu6kdqbtsnk5bhftgslio6e2jgkz6kgw6cuvvr@xbfswsczfqsi/ >> Cc: Douglas Anderson >> Cc: Dave Airlie >> Cc: Thomas Zimmermann >> Cc: Jocelyn Falempe >> Cc: dri-devel@lists.freedesktop.org >> Cc: # v6.7+ >> --- >>   drivers/gpu/drm/ast/ast_mode.c | 18 ++++++++++-------- >>   drivers/gpu/drm/ast/ast_reg.h  |  1 + >>   2 files changed, 11 insertions(+), 8 deletions(-) >> >> diff --git a/drivers/gpu/drm/ast/ast_mode.c >> b/drivers/gpu/drm/ast/ast_mode.c >> index 6b9d510c509d..fe8089266db5 100644 >> --- a/drivers/gpu/drm/ast/ast_mode.c >> +++ b/drivers/gpu/drm/ast/ast_mode.c >> @@ -836,22 +836,24 @@ ast_crtc_helper_atomic_flush(struct drm_crtc >> *crtc, >>   static void ast_crtc_helper_atomic_enable(struct drm_crtc *crtc, >> struct drm_atomic_state *state) >>   { >>       struct ast_device *ast = to_ast_device(crtc->dev); >> +    u8 vgacr17 = 0x00; >> +    u8 vgacrb6 = 0x00; >>   -    ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0xfc, 0x00); >> -    ast_set_index_reg_mask(ast, AST_IO_VGASRI, 0x01, 0xdf, 0x00); >> +    vgacr17 |= AST_IO_VGACR17_SYNC_ENABLE; >> +    vgacrb6 &= ~(AST_IO_VGACRB6_VSYNC_OFF | AST_IO_VGACRB6_HSYNC_OFF); > As vgacrb6 is 0, then this "&=" shouldn't do anything? Indeed! I'll fix that in the next rev. But the result is luckily the same, :) because clearing these bits to 0 enables sync. To give you some context on this code: Just writing plain 0x00 into the HW registers obscures what this code does. But assigning these AST_IO_ constants directly to the variables gives a compiler warning about size mismatches for storing long in u8. Hence these &= and |= constructs. So vgacrb6 should be 0xff and the &= statement clears the bits. It's a masked write below, so the remaining bits will be ignored. Best regards Thomas > >> + >> +    ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0x17, 0x7f, vgacr17); >> +    ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0xfc, vgacrb6); >>   } >>     static void ast_crtc_helper_atomic_disable(struct drm_crtc *crtc, >> struct drm_atomic_state *state) >>   { >>       struct drm_crtc_state *old_crtc_state = >> drm_atomic_get_old_crtc_state(state, crtc); >>       struct ast_device *ast = to_ast_device(crtc->dev); >> -    u8 vgacrb6; >> +    u8 vgacr17 = 0xff; >>   -    ast_set_index_reg_mask(ast, AST_IO_VGASRI, 0x01, 0xdf, >> AST_IO_VGASR1_SD); >> - >> -    vgacrb6 = AST_IO_VGACRB6_VSYNC_OFF | >> -          AST_IO_VGACRB6_HSYNC_OFF; >> -    ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0xfc, vgacrb6); >> +    vgacr17 &= ~AST_IO_VGACR17_SYNC_ENABLE; >> +    ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0x17, 0x7f, vgacr17); >>         /* >>        * HW cursors require the underlying primary plane and CRTC to >> diff --git a/drivers/gpu/drm/ast/ast_reg.h >> b/drivers/gpu/drm/ast/ast_reg.h >> index e15adaf3a80e..30578e3b07e4 100644 >> --- a/drivers/gpu/drm/ast/ast_reg.h >> +++ b/drivers/gpu/drm/ast/ast_reg.h >> @@ -29,6 +29,7 @@ >>   #define AST_IO_VGAGRI            (0x4E) >>     #define AST_IO_VGACRI            (0x54) >> +#define AST_IO_VGACR17_SYNC_ENABLE    BIT(7) /* called "Hardware >> reset" in docs */ >>   #define AST_IO_VGACR80_PASSWORD        (0xa8) >>   #define AST_IO_VGACR99_VGAMEM_RSRV_MASK    GENMASK(1, 0) >>   #define AST_IO_VGACRA1_VGAIO_DISABLED    BIT(1) > -- -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg) From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id GA05OMP/7WiajzEAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 07:46:11 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 07:46:11 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8ZjX-0000000DrDP-0hdO for hi@josie.lol; Tue, 14 Oct 2025 07:46:11 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B64B718A50AD for ; Tue, 14 Oct 2025 07:46:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6AEE1259CA5; Tue, 14 Oct 2025 07:46:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="YJtBd2mQ" X-Original-To: stable@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 5CD4F2AD0D for ; Tue, 14 Oct 2025 07:46:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760427968; cv=none; b=gOyjaFpNcZyU7oto0JEPPAmgZomOCxggWzuZjjobNWoQLnEfgc3yksmgooWhFMlfv5W8tlcts7hMSD8+ARWktLM6x/jC2nAg6VmDBkCMlQrOeO3cIwr2k6YiNxyh8tDK2k+RRM/eX0Ugl4QGIGVXjAF1RV6W3tu8Uf2JBZzsPFM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760427968; c=relaxed/simple; bh=IPxqQvpHJfvZEWlcxqJlazd4WBZ4/Mvlw54Qz969+Gc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ZyK11EGMzwGS/ppeP+G5FDxLGcri9HWFV0oEwCoht3mf5MqFDxo7spk6de1BbDjJ8rjhg7QsJCXEptbNIF3eU2SR3kcC/GkRyq5+JKh2cKj0JAZmGVEAfUwTOTqn17nUVLbAG6oE7Q5ts8zq5KsXAeR2aP2/J3/Pb5BXsw19WXw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=YJtBd2mQ; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1760427964; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZuL2StPvoHqfPKlji0n6gMA9cQYlL86+raj4IYDsJ3U=; b=YJtBd2mQMtfOQvCOcI0/aq88rJCcKwItsH4f/g3uMAwhA+3vrfxamvHeNxtNvtB8MKmlUh ZzHrL7AbCHYDk1yTjrqkYVHIBkr6F6GU9FRaCM6Ypw3SVtFVYwxX5wq1h7+7kSsSlmiNK2 34yXvTZalYJGOrxi8UVJI5SnpPRYHYw= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-222-L_5-AhtUNTG7Il6gqfgSLQ-1; Tue, 14 Oct 2025 03:46:03 -0400 X-MC-Unique: L_5-AhtUNTG7Il6gqfgSLQ-1 X-Mimecast-MFC-AGG-ID: L_5-AhtUNTG7Il6gqfgSLQ_1760427962 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-3f384f10762so4312736f8f.3 for ; Tue, 14 Oct 2025 00:46:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760427962; x=1761032762; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZuL2StPvoHqfPKlji0n6gMA9cQYlL86+raj4IYDsJ3U=; b=D+XKaWFz7DTMvWL7KRPuXFMcyCaauW801NvHfKX3xZjzwWMEazEYmJzY+kwHjLRkx1 B2rSZqXX2nm1Pgr74BkB51LFzLDQJdUURfs3/HL7aWGJBIc1xwgUYsCVzKSH2t2aDjg3 9hudRjV5wk3/+7opMSPN98lOBcop8ViF8uxEvAbvHMwUc6f5H3H5dwoXZX5kAevUBNs+ J8bZxSlKSrXgHQ1aVPjLuUYeDozbwiTEGFLZBNAb50f2Va7BCLEFMG/KVrW51JUb3rik 6CW3g/BCgEFL3nmSrOf0LK8FhdBJSXoF4VLZWZaKIl1m/bd0oA1ZgHRMqxJMGkK8ISiA 8doA== X-Forwarded-Encrypted: i=1; AJvYcCUuKC8noWO6Sd2kgf3uD/SgqjU+j72NZIe8QzDei2ZxFy9JqehzZNGQQn2LDyBJyMjJsHZvlEc=@vger.kernel.org X-Gm-Message-State: AOJu0YzaBX2MJCyXSMFSOiDM/cbhNwHAgfuuyOpgF6VNShi1xMZOkxQj gAfJtIzSwXOQiNsDxh9al1CKp8TIqIZqbJcA2DHdk99cK28HrFso0Z8XJJylk6qpBc0j+GflPpc Su7/6ybMFZdkj1gqon8mdaO9rcmqo7lw9FbWev2b6U4sR1kDmV+k/jOFuWQ== X-Gm-Gg: ASbGncsdK24QjXr6F0U21R2Z5Fw487woNApmKK1ee+TaLr6srIfndqozDPSuggR2xlE yhR4nPWp/LoaiZ4ymtO628mrmOgWbuBUqKyVNZGkdjeRpTN58HcRr24j2g1uB+NdJT0nMs4hG1A ryz5kG+HLPYxv8CJ5yEPGUEIiCxHqcRvCfUoUchYz5FHXVEbzek0XLKjRo8lVvW8oruHtpmHvEv /Unjhvfd6EZaN17NCoPDEjWASqy169ISDUFjl2C0AR3peE/qxL+KbBWZrYsFsU+M3Qrsjo7rF+6 0i0Zz+LJgcjtpG+wdwkjVHA95MU3kcFqMfKWOJgqE56bx5hpGFhtT0X6YWtwTg5fXWMPPPPGABM FJept X-Received: by 2002:a05:6000:18a9:b0:3f7:ce62:ce17 with SMTP id ffacd0b85a97d-4266e7d4406mr16641440f8f.38.1760427961677; Tue, 14 Oct 2025 00:46:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGNM2xo5ZLQVou/pRRKjxY8bstP/7kfFBfLgBcA4Pk8KnQSXsywIOTGa19BsGCsqd8RxGUA8g== X-Received: by 2002:a05:6000:18a9:b0:3f7:ce62:ce17 with SMTP id ffacd0b85a97d-4266e7d4406mr16641422f8f.38.1760427961280; Tue, 14 Oct 2025 00:46:01 -0700 (PDT) Received: from ?IPV6:2a01:e0a:c:37e0:8998:e0cf:68cc:1b62? ([2a01:e0a:c:37e0:8998:e0cf:68cc:1b62]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-426ce5cf71dsm21480168f8f.29.2025.10.14.00.46.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Oct 2025 00:46:00 -0700 (PDT) Message-ID: <9ad17cb1-3e09-4082-b52b-0b218812f114@redhat.com> Date: Tue, 14 Oct 2025 09:45:57 +0200 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] drm/ast: Blank with VGACR17 sync enable, always clear VGACRB6 sync off To: Thomas Zimmermann , airlied@redhat.com, dianders@chromium.org, nbowler@draconx.ca Cc: dri-devel@lists.freedesktop.org, stable@vger.kernel.org References: <20251010080233.21771-1-tzimmermann@suse.de> Content-Language: en-US, fr From: Jocelyn Falempe In-Reply-To: <20251010080233.21771-1-tzimmermann@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-DKIM: signer='redhat.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.80.249 listed in list.dnswl.org] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: 4 On 10/10/2025 10:02, Thomas Zimmermann wrote: > Blank the display by disabling sync pulses with VGACR17<7>. Unblank > by reenabling them. This VGA setting should be supported by all Aspeed > hardware. > > Ast currently blanks via sync-off bits in VGACRB6. Not all BMCs handle > VGACRB6 correctly. After disabling sync during a reboot, some BMCs do > not reenable it after the soft reset. The display output remains dark. > When the display is off during boot, some BMCs set the sync-off bits in > VGACRB6, so the display remains dark. Observed with Blackbird AST2500 > BMC. Clearing the sync-off bits unconditionally fixes these issues. > > Also do not modify VGASR1's SD bit for blanking, as it only disables GPU > access to video memory. One comment below:> > Signed-off-by: Thomas Zimmermann > Fixes: ce3d99c83495 ("drm: Call drm_atomic_helper_shutdown() at shutdown time for misc drivers") > Tested-by: Nick Bowler > Reported-by: Nick Bowler > Closes: https://lore.kernel.org/dri-devel/wpwd7rit6t4mnu6kdqbtsnk5bhftgslio6e2jgkz6kgw6cuvvr@xbfswsczfqsi/ > Cc: Douglas Anderson > Cc: Dave Airlie > Cc: Thomas Zimmermann > Cc: Jocelyn Falempe > Cc: dri-devel@lists.freedesktop.org > Cc: # v6.7+ > --- > drivers/gpu/drm/ast/ast_mode.c | 18 ++++++++++-------- > drivers/gpu/drm/ast/ast_reg.h | 1 + > 2 files changed, 11 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c > index 6b9d510c509d..fe8089266db5 100644 > --- a/drivers/gpu/drm/ast/ast_mode.c > +++ b/drivers/gpu/drm/ast/ast_mode.c > @@ -836,22 +836,24 @@ ast_crtc_helper_atomic_flush(struct drm_crtc *crtc, > static void ast_crtc_helper_atomic_enable(struct drm_crtc *crtc, struct drm_atomic_state *state) > { > struct ast_device *ast = to_ast_device(crtc->dev); > + u8 vgacr17 = 0x00; > + u8 vgacrb6 = 0x00; > > - ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0xfc, 0x00); > - ast_set_index_reg_mask(ast, AST_IO_VGASRI, 0x01, 0xdf, 0x00); > + vgacr17 |= AST_IO_VGACR17_SYNC_ENABLE; > + vgacrb6 &= ~(AST_IO_VGACRB6_VSYNC_OFF | AST_IO_VGACRB6_HSYNC_OFF); As vgacrb6 is 0, then this "&=" shouldn't do anything? > + > + ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0x17, 0x7f, vgacr17); > + ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0xfc, vgacrb6); > } > > static void ast_crtc_helper_atomic_disable(struct drm_crtc *crtc, struct drm_atomic_state *state) > { > struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state, crtc); > struct ast_device *ast = to_ast_device(crtc->dev); > - u8 vgacrb6; > + u8 vgacr17 = 0xff; > > - ast_set_index_reg_mask(ast, AST_IO_VGASRI, 0x01, 0xdf, AST_IO_VGASR1_SD); > - > - vgacrb6 = AST_IO_VGACRB6_VSYNC_OFF | > - AST_IO_VGACRB6_HSYNC_OFF; > - ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0xfc, vgacrb6); > + vgacr17 &= ~AST_IO_VGACR17_SYNC_ENABLE; > + ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0x17, 0x7f, vgacr17); > > /* > * HW cursors require the underlying primary plane and CRTC to > diff --git a/drivers/gpu/drm/ast/ast_reg.h b/drivers/gpu/drm/ast/ast_reg.h > index e15adaf3a80e..30578e3b07e4 100644 > --- a/drivers/gpu/drm/ast/ast_reg.h > +++ b/drivers/gpu/drm/ast/ast_reg.h > @@ -29,6 +29,7 @@ > #define AST_IO_VGAGRI (0x4E) > > #define AST_IO_VGACRI (0x54) > +#define AST_IO_VGACR17_SYNC_ENABLE BIT(7) /* called "Hardware reset" in docs */ > #define AST_IO_VGACR80_PASSWORD (0xa8) > #define AST_IO_VGACR99_VGAMEM_RSRV_MASK GENMASK(1, 0) > #define AST_IO_VGACRA1_VGAIO_DISABLED BIT(1) From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id GNHkHQEM7mhsiDIAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 08:38:25 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 08:38:25 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8aY5-0000000Fgtj-0F71 for hi@josie.lol; Tue, 14 Oct 2025 08:38:25 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 9A11A4F31F2 for ; Tue, 14 Oct 2025 08:38:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A9D1130FF09; Tue, 14 Oct 2025 08:38:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="M3rH3JTA" X-Original-To: stable@vger.kernel.org Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 CF75630FC3E; Tue, 14 Oct 2025 08:38:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760431091; cv=none; b=HUtnbetgoOF0TH43L2bO6dwMs0yWeJr2N7CBElti/lsmwQXrSoONAbCMnDCYy9K/G3hxuXZXFOvyXao7ZcjZfLBrhaWwfprDTMdLpVfxcDYbLTR0yS4PVVkXb5DEee3U1hiSyuwLXZcRFQi5vyYwTwpyLdLORCgWE10Ub+gKfoA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760431091; c=relaxed/simple; bh=xFxTZk9k8z1ceBZfTEHBte/M5l6HENgtLC2nPfTfCBg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=a49Y9pIysn9ClIk/PGzjOfCXID5/xeropoYp7dVWUri+7uflx9yeVnLLsuJi0zcuPbzQm0/TOYonglsAitqXqfLqYkCTH8xcFe4cwIOmoZw55Sr76zB5cU3zUnwVp/+4+V8xzG33AFRZayCUs6bI2vP6tNTboLj+Ya6hZ+PlJjo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=M3rH3JTA; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=teelVvdHnPXhmeC0lPG5a8S5FoS735QXhS6EymF1m+s=; b=M3rH3JTAn+2Q8+raj9gahfIn1l 3hnHsRuGMSmqmi2R7nBl1IuhQItDEyWXRsSlymaygn5upUYJ3sT63/GF9CYS0ZkZ2XUlMyqSTripQ L/ZQ/5LbOOPJMTPPB7r+rAOuu9YcYAPgEKHOzXKoqa4HKgcYuCcJ4+uilkNvfjEfEsfJBMs89cs3P w39TknT3PBmvlZGRf8MGUWsWklPP5jgL24UZ4ayH+M7RZg1cFixqdExuOlN3T7Spr9x88zZzUI7Za X50CnPRdUDd2QKK/M+45LfCIeXdRnlNMn/5oGERxdZyOTZft3a16hDB6uEO9yNg1kDqBP4LMv29ZM lQ/M4AGw==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1v8aXV-000000052l3-1yVI; Tue, 14 Oct 2025 08:37:49 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id E42FE300212; Tue, 14 Oct 2025 10:37:48 +0200 (CEST) Date: Tue, 14 Oct 2025 10:37:48 +0200 From: Peter Zijlstra To: George Kennedy Cc: ravi.bangoria@amd.com, harshit.m.mogalapalli@oracle.com, mingo@redhat.com, acme@kernel.org, namhyung@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com, kan.liang@linux.intel.com, tglx@linutronix.de, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, dongli.zhang@oracle.com, stable@vger.kernel.org Subject: Re: [PATCH] [PATCH v3] perf/x86/amd: check event before enable to avoid GPF Message-ID: <20251014083748.GP3245006@noisy.programming.kicks-ass.net> References: <1728392453-18658-1-git-send-email-george.kennedy@oracle.com> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1728392453-18658-1-git-send-email-george.kennedy@oracle.com> X-DKIM: signer='infradead.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: infradead.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On Tue, Oct 08, 2024 at 08:00:53AM -0500, George Kennedy wrote: > On AMD machines cpuc->events[idx] can become NULL in a subtle race > condition with NMI->throttle->x86_pmu_stop(). > > Check event for NULL in amd_pmu_enable_all() before enable to avoid a GPF. > This appears to be an AMD only issue. > > Syzkaller reported a GPF in amd_pmu_enable_all. > > INFO: NMI handler (perf_event_nmi_handler) took too long to run: 13.143 > msecs > Oops: general protection fault, probably for non-canonical address > 0xdffffc0000000034: 0000 PREEMPT SMP KASAN NOPTI > KASAN: null-ptr-deref in range [0x00000000000001a0-0x00000000000001a7] > CPU: 0 UID: 0 PID: 328415 Comm: repro_36674776 Not tainted 6.12.0-rc1-syzk > RIP: 0010:x86_pmu_enable_event (arch/x86/events/perf_event.h:1195 > arch/x86/events/core.c:1430) > RSP: 0018:ffff888118009d60 EFLAGS: 00010012 > RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000000 > RDX: 0000000000000034 RSI: 0000000000000000 RDI: 00000000000001a0 > RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000000 > R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000002 > R13: ffff88811802a440 R14: ffff88811802a240 R15: ffff8881132d8601 > FS: 00007f097dfaa700(0000) GS:ffff888118000000(0000) GS:0000000000000000 > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > CR2: 00000000200001c0 CR3: 0000000103d56000 CR4: 00000000000006f0 > Call Trace: > > amd_pmu_enable_all (arch/x86/events/amd/core.c:760 (discriminator 2)) > x86_pmu_enable (arch/x86/events/core.c:1360) > event_sched_out (kernel/events/core.c:1191 kernel/events/core.c:1186 > kernel/events/core.c:2346) > __perf_remove_from_context (kernel/events/core.c:2435) > event_function (kernel/events/core.c:259) > remote_function (kernel/events/core.c:92 (discriminator 1) > kernel/events/core.c:72 (discriminator 1)) > __flush_smp_call_function_queue (./arch/x86/include/asm/jump_label.h:27 > ./include/linux/jump_label.h:207 ./include/trace/events/csd.h:64 > kernel/smp.c:135 kernel/smp.c:540) > __sysvec_call_function_single (./arch/x86/include/asm/jump_label.h:27 > ./include/linux/jump_label.h:207 > ./arch/x86/include/asm/trace/irq_vectors.h:99 arch/x86/kernel/smp.c:272) > sysvec_call_function_single (arch/x86/kernel/smp.c:266 (discriminator 47) > arch/x86/kernel/smp.c:266 (discriminator 47)) > > > Reported-by: syzkaller > Signed-off-by: George Kennedy > --- Without a Fixes tag it goes into perf/core. From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id uMSyNNYM7mginjgAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 08:41:58 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 08:41:58 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8abW-0000000FoAa-1g7k for hi@josie.lol; Tue, 14 Oct 2025 08:41:58 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C96E61888900 for ; Tue, 14 Oct 2025 08:42:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A0ECA305E00; Tue, 14 Oct 2025 08:41:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="GJkksp4C"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="1pKlrCZu" X-Original-To: stable@vger.kernel.org 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 61AED265CB2; Tue, 14 Oct 2025 08:41:51 +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=1760431313; cv=none; b=By+6YcUHSwVkA69IGJlPzjcVZ5U97atVrFdGEPRAF8hpsXDv/aWFF7i1orDDkDvh1HXefgCY3RlN4Xyk6mXnXXrMlKRZQFJ97WzU6jM9qmn/S+Sr2bslSrQBZT1JqUeAEPIffKw3cMc857NEoztVTOYzkyjc65plApogJgNRV0s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760431313; c=relaxed/simple; bh=ItRUKErWC0QhcWd0s6SC26fn3FTvNzSVCBpjY5Hdxww=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=uPnNm7WDVUZ0txzSE5CPwchmOcJ5qDozq15jt+CuJwR7TEegjlUu5RoVG9eC3I6c6Cc/6HYorP6Znbg79OnXbhY1dk/5pyATumosXo8BCEMPRPVLdx4QWu+yl+Pu+CY85e0bfyswbwUA4l14ijlt30DXit5Oa1ngVwnXgVhbc60= 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=GJkksp4C; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=1pKlrCZu; 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 Date: Tue, 14 Oct 2025 08:41:46 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1760431308; 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=yyXEC29O3ckp/+owfD4P7Jw16sRGibwoK39+dlwavbI=; b=GJkksp4CD7Ht0llinrQJWTtBZk29sXyqbiPWLfEJL0wUG028nnAJZqE1q9kPUxTbvLsqvP S+r67eiqeOYYslWFFaNkLs46J1Q5F3cBlABl6kw0z0SlA37yImZZwX6XKcYuV4Q2Imk7d3 Orm3tAPC6QMAbd7Ntr9jzlZryTnN77ITZwS3fhaZ3y+3wg7B8sU9Ijx3gf9+qhjyiYUyLp 1sk+1+7bqDoZNn/4Pzbyu7PIJBosOXnX6YfzEA7srlQ4fzRNW2aGkbBJLylIeCaJkTMnHs S3CwSqqlkvolAq2lYjExQN5DxMQggylRvb9zfNzB5rKJGTJIBKAqlBCa8AgFTQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1760431308; 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=yyXEC29O3ckp/+owfD4P7Jw16sRGibwoK39+dlwavbI=; b=1pKlrCZu94I6TLiPd2KnVlcFUUIerd1KEv6ShYxuaYJQC3bKfZpN8WudYzqfGLiShpofbp sl0mpaCyg5uOn3CA== From: "tip-bot2 for Adrian Hunter" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/urgent] perf/core: Fix MMAP2 event device with backing files Cc: Adrian Hunter , "Peter Zijlstra (Intel)" , Amir Goldstein , stable@vger.kernel.org, #@tip-bot2.tec.linutronix.de, 6.8@tip-bot2.tec.linutronix.de, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20251013072244.82591-4-adrian.hunter@intel.com> References: <20251013072244.82591-4-adrian.hunter@intel.com> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <176043130631.709179.12566321865328896091.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-DKIM: signer='linutronix.de' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: perf.data] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.80.249 listed in list.dnswl.org] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 The following commit has been merged into the perf/urgent branch of tip: Commit-ID: fa4f4bae893fbce8a3edfff1ab7ece0c01dc1328 Gitweb: https://git.kernel.org/tip/fa4f4bae893fbce8a3edfff1ab7ece0c01d= c1328 Author: Adrian Hunter AuthorDate: Mon, 13 Oct 2025 10:22:44 +03:00 Committer: Peter Zijlstra CommitterDate: Tue, 14 Oct 2025 10:38:10 +02:00 perf/core: Fix MMAP2 event device with backing files Some file systems like FUSE-based ones or overlayfs may record the backing file in struct vm_area_struct vm_file, instead of the user file that the user mmapped. That causes perf to misreport the device major/minor numbers of the file system of the file, and the generation of the file, and potentially other inode details. There is an existing helper file_user_inode() for that situation. Use file_user_inode() instead of file_inode() to get the inode for MMAP2 events. Example: Setup: # cd /root # mkdir test ; cd test ; mkdir lower upper work merged # cp `which cat` lower # mount -t overlay overlay -olowerdir=3Dlower,upperdir=3Dupper,workdir=3D= work merged # perf record -e cycles:u -- /root/test/merged/cat /proc/self/maps ... 55b2c91d0000-55b2c926b000 r-xp 00018000 00:1a 3419 = /root/test/merged/cat ... [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.004 MB perf.data (5 samples) ] # # stat /root/test/merged/cat File: /root/test/merged/cat Size: 1127792 Blocks: 2208 IO Block: 4096 regular file Device: 0,26 Inode: 3419 Links: 1 Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2025-09-08 12:23:59.453309624 +0000 Modify: 2025-09-08 12:23:59.454309624 +0000 Change: 2025-09-08 12:23:59.454309624 +0000 Birth: 2025-09-08 12:23:59.453309624 +0000 Before: Device reported 00:02 differs from stat output and /proc/self/maps # perf script --show-mmap-events | grep /root/test/merged/cat cat 377 [-01] 243.078558: PERF_RECORD_MMAP2 377/377: [0x55= b2c91d0000(0x9b000) @ 0x18000 00:02 3419 2068525940]: r-xp /root/test/merged/= cat After: Device reported 00:1a is the same as stat output and /proc/self/maps # perf script --show-mmap-events | grep /root/test/merged/cat cat 362 [-01] 127.755167: PERF_RECORD_MMAP2 362/362: [0x55= ba6e781000(0x9b000) @ 0x18000 00:1a 3419 0]: r-xp /root/test/merged/cat With respect to stable kernels, overlayfs mmap function ovl_mmap() was added in v4.19 but file_user_inode() was not added until v6.8 and never back-ported to stable kernels. FMODE_BACKING that it depends on was added in v6.5. This issue has gone largely unnoticed, so back-porting before v6.8 is probably not worth it, so put 6.8 as the stable kernel prerequisite version, although in practice the next long term kernel is 6.12. Signed-off-by: Adrian Hunter Signed-off-by: Peter Zijlstra (Intel) Acked-by: Amir Goldstein Cc: stable@vger.kernel.org # 6.8 --- kernel/events/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 7b5c237..177e57c 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -9403,7 +9403,7 @@ static void perf_event_mmap_event(struct perf_mmap_even= t *mmap_event) flags |=3D MAP_HUGETLB; =20 if (file) { - struct inode *inode; + const struct inode *inode; dev_t dev; =20 buf =3D kmalloc(PATH_MAX, GFP_KERNEL); @@ -9421,7 +9421,7 @@ static void perf_event_mmap_event(struct perf_mmap_even= t *mmap_event) name =3D "//toolong"; goto cpy_name; } - inode =3D file_inode(vma->vm_file); + inode =3D file_user_inode(vma->vm_file); dev =3D inode->i_sb->s_dev; ino =3D inode->i_ino; gen =3D inode->i_generation; From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id 6DeXFh4N7mifJDUAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 08:43:10 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 08:43:10 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8acg-0000000FqKa-0FPM for hi@josie.lol; Tue, 14 Oct 2025 08:43:10 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id BAA684EEAF1 for ; Tue, 14 Oct 2025 08:42:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2D4CD30FC09; Tue, 14 Oct 2025 08:42:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ha5QqP+U"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="YR5sRtmW" X-Original-To: stable@vger.kernel.org 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 6F8C31DC9B1; Tue, 14 Oct 2025 08:42:21 +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=1760431343; cv=none; b=sML4n8/xonhxUvT+llc52mGXupI6KUOEYJ918pIHm3XbMePrfqDRu3rk3OFyECPm5h6uPxFfv+6kAcpVEA+5rgtAcGAmgg7PmVx2aQcPr71ew4bC8d50artcKRmLkTB2wkV40BasG5A5X6Kdio88XPZpeYs6QvaMZXs+XcQmphc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760431343; c=relaxed/simple; bh=jN1txmW4DYK3O77wZiYZevfMSxECwSPhBES+l7pO21U=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=a0G4Z7/wpgZCX/5/HXiH74klpaQFvb8PkD1uhs/Becw+BGLJ6435kzPU0GpK41S5vv8xY74/Q5xlkH/cCJ9rkb4rc7+ZoyoKzqMKfvJ4pyN211dArFnT5Z69svWy2dDi2Gyd4zwcw1aZYQ5jtUOyTGGX/Yua4S9hdh8eBXuhFFc= 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=ha5QqP+U; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=YR5sRtmW; 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 Date: Tue, 14 Oct 2025 08:41:48 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1760431339; 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=oQEo0lhB2INTy8jYKZ3qg3gnU7jjerUOVngVAUS6gDg=; b=ha5QqP+UPEscValDjacor8vvOOq+vFUqtOPOs9Lf5WYqBiiPbUtfX9eHmAX6bNpp2nURBl obKgQcSVHJ627XBTiwEXAr2VQ0eelNeyOmBq4JvxpcuCQH2M8HLgZMLnsWrQ4mIeviKKpQ QkZBgb6UIRTG0+22trzJ7rw72KfXSBBCVHV+K5TX5bMcILtVLGHLkWjUkDg6g6C87W1pCm uxRMtnsGlYqTMCD9MOfjo+NTtAsBrOe/R6jZEwYULiV3xSskWGpqEDxdo0dIBQWVPEojG5 K7kX/swxXkdi5ctWR6aPrxKNflPCimEKlNG1T5reTKY22rnei77FlJ1KKqZpag== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1760431339; 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=oQEo0lhB2INTy8jYKZ3qg3gnU7jjerUOVngVAUS6gDg=; b=YR5sRtmWVZYnq13zcFSV1zLl5I2+3muU17/CJ8U1KS0xEqN7xmB5RSt7m9TcN/EfiemU0a WU11J1KmiTNZD7Bg== From: "tip-bot2 for Adrian Hunter" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/urgent] perf/core: Fix MMAP event path names with backing files Cc: Adrian Hunter , "Peter Zijlstra (Intel)" , Amir Goldstein , stable@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20251013072244.82591-3-adrian.hunter@intel.com> References: <20251013072244.82591-3-adrian.hunter@intel.com> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <176043130853.709179.8229902411342716100.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-DKIM: signer='linutronix.de' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: perf.data] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 The following commit has been merged into the perf/urgent branch of tip: Commit-ID: 8818f507a9391019a3ec7c57b1a32e4b386e48a5 Gitweb: https://git.kernel.org/tip/8818f507a9391019a3ec7c57b1a32e4b386= e48a5 Author: Adrian Hunter AuthorDate: Mon, 13 Oct 2025 10:22:43 +03:00 Committer: Peter Zijlstra CommitterDate: Tue, 14 Oct 2025 10:38:09 +02:00 perf/core: Fix MMAP event path names with backing files Some file systems like FUSE-based ones or overlayfs may record the backing file in struct vm_area_struct vm_file, instead of the user file that the user mmapped. Since commit def3ae83da02f ("fs: store real path instead of fake path in backing file f_path"), file_path() no longer returns the user file path when applied to a backing file. There is an existing helper file_user_path() for that situation. Use file_user_path() instead of file_path() to get the path for MMAP and MMAP2 events. Example: Setup: # cd /root # mkdir test ; cd test ; mkdir lower upper work merged # cp `which cat` lower # mount -t overlay overlay -olowerdir=3Dlower,upperdir=3Dupper,workdir=3D= work merged # perf record -e intel_pt//u -- /root/test/merged/cat /proc/self/maps ... 55b0ba399000-55b0ba434000 r-xp 00018000 00:1a 3419 = /root/test/merged/cat ... [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.060 MB perf.data ] # Before: File name is wrong (/cat), so decoding fails: # perf script --no-itrace --show-mmap-events cat 367 [016] 100.491492: PERF_RECORD_MMAP2 367/367: [0x55= b0ba399000(0x9b000) @ 0x18000 00:02 3419 489959280]: r-xp /cat ... # perf script --itrace=3De | wc -l Warning: 19 instruction trace errors 19 # After: File name is correct (/root/test/merged/cat), so decoding is ok: # perf script --no-itrace --show-mmap-events cat 364 [016] 72.153006: PERF_RECORD_MMAP2 364/364: [= 0x55ce4003d000(0x9b000) @ 0x18000 00:02 3419 3132534314]: r-xp /root/test/mer= ged/cat # perf script --itrace=3De # perf script --itrace=3De | wc -l 0 # Fixes: def3ae83da02f ("fs: store real path instead of fake path in backing fi= le f_path") Signed-off-by: Adrian Hunter Signed-off-by: Peter Zijlstra (Intel) Acked-by: Amir Goldstein Cc: stable@vger.kernel.org --- kernel/events/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index cd63ec8..7b5c237 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -9416,7 +9416,7 @@ static void perf_event_mmap_event(struct perf_mmap_even= t *mmap_event) * need to add enough zero bytes after the string to handle * the 64bit alignment we do later. */ - name =3D file_path(file, buf, PATH_MAX - sizeof(u64)); + name =3D d_path(file_user_path(file), buf, PATH_MAX - sizeof(u64)); if (IS_ERR(name)) { name =3D "//toolong"; goto cpy_name; From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id 4OQLB0MQ7miF6zoAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 08:56:35 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 08:56:35 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8ape-0000000GGsN-3gtr for hi@josie.lol; Tue, 14 Oct 2025 08:56:35 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 0E8F84E5138 for ; Tue, 14 Oct 2025 08:56:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DAFA12877CB; Tue, 14 Oct 2025 08:56:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="DBoF7f5C" X-Original-To: linux-s390@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 5033A2DF71C for ; Tue, 14 Oct 2025 08:56:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760432190; cv=none; b=XMordyuZyc+0f9R6glBKvVuoxiSY1lGz6c8qmpsgJYwTUqY6HTJKsrTTWwVDOdhyqo3p509RgB/AsKoj6CbTKffVz1nbReO2fxsTeQ0rrAlOAnkzbsHgSrPPmdSsA++K5IQFVorO3y8DZ5EWqLZKoi7fQQ0+luGUczzFV1CTsn0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760432190; c=relaxed/simple; bh=Gx9Z6mn6RyElOVVuTuwoqX8a6quS8JbkEQ2dofakRLs=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=oHJPjMkh/7DZGmhV/gufxF+2YyJLtueGuYnrMNucbaLlWLa+ahZM7x9pXoWBrytsYT+d1vdkcIkEHp/weR9Nrs2nAGc2WkRCYsr8dTk7+3ZKXYmcYtqtSrvxhUlNmZQdkyEytr4peTdLGb1+KpxuUyYe6uzEK5aW3FUUzF/N4IE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=DBoF7f5C; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1760432188; 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=SzW2cWfpQXuLGQqbaNqxu1i17z4sh2RC+KzHuoIl4BY=; b=DBoF7f5CJLx8LIEZz8p61JrmQjd/o8kqXzoXDelIZykH9/2k+qSWOTHcXY1m2fAgPplnlj B+Yk1BjRGANpl92ORb4WnhFgnnk/4MKCpHnThWdJZ+342siCBJMd8/mzbgf8M/xEsli2fS TAYPsF0lHpiQr1OxWs1bPmjHgAyTLdw= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-301-88ZyZhZiPSKzb3dgMZdLLQ-1; Tue, 14 Oct 2025 04:56:22 -0400 X-MC-Unique: 88ZyZhZiPSKzb3dgMZdLLQ-1 X-Mimecast-MFC-AGG-ID: 88ZyZhZiPSKzb3dgMZdLLQ_1760432179 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8A5F2180045C; Tue, 14 Oct 2025 08:56:17 +0000 (UTC) Received: from fweimer-oldenburg.csb.redhat.com (unknown [10.44.33.199]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E4B5F19560A2; Tue, 14 Oct 2025 08:56:08 +0000 (UTC) From: Florian Weimer To: Andy Lutomirski Cc: Dave Hansen , Thomas =?utf-8?Q?Wei=C3=9Fschuh?= , Huacai Chen , WANG Xuerui , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Richard Weinberger , Anton Ivanov , Johannes Berg , Vincenzo Frascino , Shuah Khan , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-um@lists.infradead.org, linux-api@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v2] vdso: Remove struct getcpu_cache In-Reply-To: (Andy Lutomirski's message of "Mon, 13 Oct 2025 10:14:58 -0700") References: <20251013-getcpu_cache-v2-1-880fbfa3b7cc@linutronix.de> Date: Tue, 14 Oct 2025 10:56:06 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-DKIM: signer='redhat.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: 4 * Andy Lutomirski: > The theory is that people thought that getcpu was going to be kind of > slow, so userspace would allocate a little cache (IIRC per-thread) and > pass it in, and the vDSO would do, well, something clever to return > the right value. The something clever was probably based on the idea > that you can't actually tell (in general) if the return value from > getcpu is stale, since you might well get migrated right as the > function returns anyway, so the cache could be something silly like > (jiffies, cpu). It probably had to do something with per-CPU or per-node mappings of the vDSO. Or may some non-coherent cache line in the vDSO. As far as I understand it, the cache has zero chance of working with the way vDSO data is currently implemented. We have the CPU ID and node ID in the restartable sequences area now (although glibc does not use the node ID yet). It's not a cache. So this clearly supersedes whatever struct getcpu_cache tried to achieve. Thanks, Florian From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id 0NCZFc9q7WgEWCYAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 21:10:39 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 21:10:39 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8PoV-0000000AhGK-07YG for hi@josie.lol; Mon, 13 Oct 2025 21:10:39 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8B40A18A811A for ; Mon, 13 Oct 2025 21:11:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A561726E706; Mon, 13 Oct 2025 21:10:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b="cMd67WoO" X-Original-To: linux-s390@vger.kernel.org Received: from mail.zytor.com (terminus.zytor.com [198.137.202.136]) (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 C438A219E8; Mon, 13 Oct 2025 21:10:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.136 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760389832; cv=none; b=FtRGN+lZ5Kui57TBtAIwZFrPGnqARChX1GObBHa5oA+lzVoF+dtOFLQcBg358g0AjC7aTlbjkp7UhAclZSwtEQNVPiw2gdRGl6F6sf71ijAdrhfe6bKdKCN3ST6N+gvMfbnTwCfv9yxLUaqofRbcsjWlJNl3X7QXGvj3R3Xse14= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760389832; c=relaxed/simple; bh=QHrvRQIH47qXD6u+vvXuJD2fKTMeGYp+Cqv3jTGMrGw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=R4TZPdl1bsG7KTXhDAhqUysQBaTOnLW5G9J85VYuUKOTlqko34TmfcSxUqk0xtAW9kLETIHTvg/6opYiG3ckGIyM7l34AB1ye8ukPpEpv3/s3121eQVmNXg2jWnGpXzjFzu8LQ1u5gu06iVE9onG1f5VlkT7tPt7Cstq6lIndj8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com; spf=pass smtp.mailfrom=zytor.com; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b=cMd67WoO; arc=none smtp.client-ip=198.137.202.136 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zytor.com Received: from [IPV6:2601:646:8081:9484:201e:bc0f:a7c6:ca8d] ([IPv6:2601:646:8081:9484:201e:bc0f:a7c6:ca8d]) (authenticated bits=0) by mail.zytor.com (8.18.1/8.17.1) with ESMTPSA id 59DL9bFB1473312 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Mon, 13 Oct 2025 14:09:37 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 59DL9bFB1473312 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2025092201; t=1760389780; bh=OzCgvPG4aCYIt5U2/uF5XWAxPeOEelq2YRV2TeCo8zQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=cMd67WoOzA4jU4tRxio15jlNW2gMHZRxCZExgtMI3hc6F1bR+FFsKY5zGygn7k4Ht 1jzcy6j8UKiFa4jjP8JG4Ukwnmr9yOlz+dgxvT0Z1Qc60vjnoLiye+3tZQBQ33a4ck POM5nApdVKga/EVyRL79HJiBHLfa+Hobx5BtA7IrG1kqj+u/TEhFdQrUicdfBg6oia wtIwnrOtj7NJhqoOeS4J+3SZq3L4Xy38DiBL5iXRQ11zCbdpPFpRSPqcljY0ZvD95d Nnra0LThGgnrPnoBBmno0+2CHn+URmyBysN69/FI+IK6z4sK7RBrtSQ5jiyOJLJ2gI WkYz9DUtkxygQ== Message-ID: Date: Mon, 13 Oct 2025 14:09:31 -0700 Precedence: bulk X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] vdso: Remove struct getcpu_cache To: Andy Lutomirski Cc: Dave Hansen , =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= , Huacai Chen , WANG Xuerui , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Richard Weinberger , Anton Ivanov , Johannes Berg , Vincenzo Frascino , Shuah Khan , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-um@lists.infradead.org, linux-api@vger.kernel.org, linux-kselftest@vger.kernel.org References: <20251013-getcpu_cache-v2-1-880fbfa3b7cc@linutronix.de> <494caf29-8755-4bc6-a2c3-b9d0b3e9b78d@zytor.com> Content-Language: en-US, sv-SE From: "H. Peter Anvin" In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-DKIM: signer='zytor.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [147.75.80.249 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: zytor.com] -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: -18 On 2025-10-13 13:32, Andy Lutomirski wrote: > > The global timestamp would just be some field in the vvar area, which > we have plenty of anyway. > > But I agree, accelerating getcpu is pointless. In any case, anything > that historically thought it really really wanted accelerated getcpu > can, and probably does, use rseq these days. > Indeed. And with RDPID it is fast enough that the bulk of the cost is probably in the vdso call. -hpa From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id eAIfFhpi7WgIIx0AYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 20:33:30 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 20:33:30 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8PEX-00000009R9E-3I0V for hi@josie.lol; Mon, 13 Oct 2025 20:33:30 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6145318A7673 for ; Mon, 13 Oct 2025 20:33:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB95B30ACEA; Mon, 13 Oct 2025 20:32:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="a0TGhUDG" X-Original-To: linux-s390@vger.kernel.org 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 A53AA3093CD for ; Mon, 13 Oct 2025 20:32:44 +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=1760387564; cv=none; b=n7rbDCYDmj1ULSdPn4RWDDxVBJaOOasBfwc1ldPwRLFlGHDESkT9moyd8bbb/18R5WERukffK+3oLeKVuKRMTG5ZbvAoeRGK2IOWlaMj3F1dD7SJrnrPV2pvlhSgxdSwvWpnokEeGh1CzFQUeAHUCVc8sS58q+RhoZoEzdANif0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760387564; c=relaxed/simple; bh=EQamDqz1jKPoQmI1VU+7+EDF4P83/GJiuJy793deQ/E=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=UKewHkINYKD+MO9jIDUAM3T7o4vdGsMn+n6O95mDaVjnpUdCbZMsDS122Ybg/vvsByeD9x3xTe2n4a7ypElimB66yd3a9XsLO/CxZ04+lTnXvfnXRu92rKxO2n80fT1Y7lNYvbrGGlLj+aLgxFTscXrVpUNAznYx5cJAeB/AR+Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=a0TGhUDG; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5129CC2BCB5 for ; Mon, 13 Oct 2025 20:32:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760387564; bh=EQamDqz1jKPoQmI1VU+7+EDF4P83/GJiuJy793deQ/E=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=a0TGhUDGi+/iEdmyQcN7ciepwiJneRt84J2Q47Mg0Hfd4qYoV0nDT/VW7h0s2ry3Z UVV00W9Ei/GJlG+rdKc6ZlPYFwTl+/bCLj16ev+4AU8/JDhlDu/JcXQTbJYciVtIBJ cO3woUFa3/jybo72rgiF1rduIh3xpL/lHTEG4r7c4Fp9eLly+DErNgLe+27VBIJc1s zdn8viiPJ1iye98izFeQmaI6k6oIq38bCfMoNBM+78rD+g+zSlHLdR0LScRisdtrZs Paxcu7Y/ygZr5dqIHFp51TS2CjZ9WkewPvGMZvbHxkAdueG+YfnDLKCxr2gIievjdV W25v0hLI2v1eg== Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-57e36125e8aso1074995e87.2 for ; Mon, 13 Oct 2025 13:32:44 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCWlGsue90kSbYocFRY/aQBYG+zHSK/wVr6Y5MCC0V8++Vp30N9NGQlut9gnbUm/kPYSeE86RtTtEfGu@vger.kernel.org X-Gm-Message-State: AOJu0YwwsDZketRxs3NM2Hx3wLwVAHlFT7dGiguWkDqQIlFkjD77Fk26 HqEvwDYmS8Gk3by06PeaPF4EFiUu0JqOviETD4pUWzY4+We2BTKuNykCFjSaal9n1XXx369vH5L P+hP+lEYQKooxwMD9tmlgqVA6+wtSyPyrx2ZPG3jp X-Google-Smtp-Source: AGHT+IFm/qhJPRKGc+a+TWhUwJHmseKnmX3UsC7EjJHnIC1kG1AUHBMR9nLxzbY5e9K0EIzQFCLgbzgnfLD4YXcOdbY= X-Received: by 2002:a05:6512:3045:b0:58b:23e:253 with SMTP id 2adb3069b0e04-5906db04028mr6538684e87.7.1760387562236; Mon, 13 Oct 2025 13:32:42 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20251013-getcpu_cache-v2-1-880fbfa3b7cc@linutronix.de> <494caf29-8755-4bc6-a2c3-b9d0b3e9b78d@zytor.com> In-Reply-To: <494caf29-8755-4bc6-a2c3-b9d0b3e9b78d@zytor.com> From: Andy Lutomirski Date: Mon, 13 Oct 2025 13:32:30 -0700 X-Gmail-Original-Message-ID: X-Gm-Features: AS18NWDkjUWHXDVipeI6h9oFzsXdlHdU2eK-6BrfttbpUi-mL82DSNY6ulu9J34 Message-ID: Subject: Re: [PATCH v2] vdso: Remove struct getcpu_cache To: "H. Peter Anvin" Cc: Andy Lutomirski , Dave Hansen , =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= , Huacai Chen , WANG Xuerui , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Richard Weinberger , Anton Ivanov , Johannes Berg , Vincenzo Frascino , Shuah Khan , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-um@lists.infradead.org, linux-api@vger.kernel.org, linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -3.5 (---) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-3.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [147.75.80.249 listed in list.dnswl.org] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -34 On Mon, Oct 13, 2025 at 12:45=E2=80=AFPM H. Peter Anvin wro= te: > > On 2025-10-13 10:14, Andy Lutomirski wrote: > > > > I don't actually remember whether the kernel ever used this. It's > > possible that there are ancient kernels where passing a wild, non-null > > pointer would blow up. But it's certainly safe to pass null, and it's > > certainly safe for the kernel to ignore the parameter. > > > > One could imagine an architecture which would have to execute an actual s= ystem > call wanting to use this, but on x86 it is pointless -- even the LSL tric= k is > much faster than a system call, and once you account for whatever hassle = you > would have to deal with do make the cache make sense (probably having a g= lobal > generation number and/or a timestamp to expire it) it well and truly make= s no > sense. The global timestamp would just be some field in the vvar area, which we have plenty of anyway. But I agree, accelerating getcpu is pointless. In any case, anything that historically thought it really really wanted accelerated getcpu can, and probably does, use rseq these days. --Andy From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id 4NhBKOFW7Wi6IRsAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 19:45:37 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 19:45:37 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8OUD-00000007pMu-0kbg for hi@josie.lol; Mon, 13 Oct 2025 19:45:37 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id CFF6418A2D39 for ; Mon, 13 Oct 2025 19:45:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 13AFD1FBEA6; Mon, 13 Oct 2025 19:45:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b="OIcplRen" X-Original-To: linux-s390@vger.kernel.org Received: from mail.zytor.com (terminus.zytor.com [198.137.202.136]) (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 8B057155322; Mon, 13 Oct 2025 19:45:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.136 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760384732; cv=none; b=Jq906uWRlV1kYCTZMLp9whEtTSPKSRV5RAWzvvy7Y91piPv9gugTXYIVUHq2m6825QoklcbCTk+IujbcCC7mwnGcwoaQ4gZfKoRd6jQ6RqU0ViJufb/NwKTCNwuPFnEqk5GPDIfooRIEYVZ0eZEy6hZwoGbx8M6Dg8UsRLwaUOk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760384732; c=relaxed/simple; bh=MY+YRUQKLtJYZJyEq96fgMk0w7vwxMzr5S0vyCUFB6Y=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=j0OcLAPG7lrlnfw6TFJWqNv4JE0CMFCH1dXwmiVzNmvRFQKpCycCYJNxneeEJRU37itw6Elz/DRirdbmc1i2Qunwv9ViP6b3XaEw4/V+fS3N+O+641T1cxJw1eWqD6GCwFYLeUG9Bz+8u4EaNm79nG1i504TmujJ1G9BNuLzbIw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com; spf=pass smtp.mailfrom=zytor.com; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b=OIcplRen; arc=none smtp.client-ip=198.137.202.136 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zytor.com Received: from [IPV6:2601:646:8081:9484:201e:bc0f:a7c6:ca8d] ([IPv6:2601:646:8081:9484:201e:bc0f:a7c6:ca8d]) (authenticated bits=0) by mail.zytor.com (8.18.1/8.17.1) with ESMTPSA id 59DJiSUF1442566 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Mon, 13 Oct 2025 12:44:32 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 59DJiSUF1442566 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2025092201; t=1760384682; bh=1aJOeaPPB1LUMhLyvXF0SOu3n0ovMqgDmMOTUIZYXXs=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=OIcplRenwsuEFxrQG/i7vbTNL5ee01maFltEu/9+zMjTrqySBAieZqr/Jnicpqoey b2HHI6yIRprdPUAGYIWjF/kEanvHHWXiC6nPSVA5IqK35TSVZ+7IrLFGmq98r1j8DZ V5aeeP4aUdWPcHl9xR2EvzbOu0Jiq4U5iHSVyec1uPZV1rwgNuPSY0NPtjes+43aIl K+H3VHnCes599MCCY8JoDUtC3q84PpJfE6CcvcH+f08aBA9dJ3t2a/zXK+rcx8az32 UvQcHsa4qPbKZ9DC6gaWyDpFxKVkpNfFVN7H2GKOXZ8fif9gO0qQ83SQs1WuiyNyu6 EQ1aEfan++sog== Message-ID: <494caf29-8755-4bc6-a2c3-b9d0b3e9b78d@zytor.com> Date: Mon, 13 Oct 2025 12:44:19 -0700 Precedence: bulk X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] vdso: Remove struct getcpu_cache To: Andy Lutomirski , Dave Hansen Cc: =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= , Huacai Chen , WANG Xuerui , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Richard Weinberger , Anton Ivanov , Johannes Berg , Vincenzo Frascino , Shuah Khan , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-um@lists.infradead.org, linux-api@vger.kernel.org, linux-kselftest@vger.kernel.org References: <20251013-getcpu_cache-v2-1-880fbfa3b7cc@linutronix.de> Content-Language: en-US, sv-SE From: "H. Peter Anvin" In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-DKIM: signer='zytor.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: zytor.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.80.249 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On 2025-10-13 10:14, Andy Lutomirski wrote: > > I don't actually remember whether the kernel ever used this. It's > possible that there are ancient kernels where passing a wild, non-null > pointer would blow up. But it's certainly safe to pass null, and it's > certainly safe for the kernel to ignore the parameter. > One could imagine an architecture which would have to execute an actual system call wanting to use this, but on x86 it is pointless -- even the LSL trick is much faster than a system call, and once you account for whatever hassle you would have to deal with do make the cache make sense (probably having a global generation number and/or a timestamp to expire it) it well and truly makes no sense. -hpa From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id YEXXACE17Wh6NggAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 17:21:37 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 17:21:37 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8MEq-00000002q26-3Fl2 for hi@josie.lol; Mon, 13 Oct 2025 17:21:36 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id B41E14F2DE6 for ; Mon, 13 Oct 2025 17:15:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AE7FB2C159C; Mon, 13 Oct 2025 17:15:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nInNi8ld" X-Original-To: linux-s390@vger.kernel.org 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 8796B2C11EC for ; Mon, 13 Oct 2025 17:15:12 +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=1760375712; cv=none; b=e0yAV3v4TLwlFEJVvzymDAbWtVUuMEgg9n+SbQy7J+F+GyWADtghO2k4dk/iTqZ65EwkFuifl2G11wgjcCJQ6yxW4lY8ZP6GsF0mfpesnDMkbW1HEURqPCc45Z1TnwL4WKTUb9YXcNJQaO11c3Tfn5pB48+nNOfJrmXCYrLR1No= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760375712; c=relaxed/simple; bh=qg3NRHdeNA4Fg5h3g9E13z1ZmJaUuUt4rsIs+bfAZf0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=gg7AwL5XV1CTlvy1t5ucoBiDG/3zpw/NxGRewtKu3yP7tnH3VUks5roV5H6qLILpF3dFKqOL7uDp8805AtVJMHpH4hVoJ9Y30syA884QHAHoAgZwz1Kq0Nz9vdmPq7O6PoiNc+NXEOA8d7OBLDW06F9/D6OXU76MACOqZHg3HBI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nInNi8ld; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6611BC19424 for ; Mon, 13 Oct 2025 17:15:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760375712; bh=qg3NRHdeNA4Fg5h3g9E13z1ZmJaUuUt4rsIs+bfAZf0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=nInNi8ldgd1mbqOSNYEn0pvWDU/WshfNHypWq71z7uedvu9QnRfeqGNexbgxkQWls f2uSbfqG61R0A7mseEzZHj5XzQdF4CKWpU8WYjlz7LGv0ZD7jEV1HjvOJDz4QmW1nv 7xejInsLO+AwE5lGA5DuIDUXa905yRbcZf8QTe1rCeC1iR7E3MOR2rj1iOyyl3h8E6 q56Yj6mpnz4vm1ikUfWkH3B45H06p59zFUjdS/IoBGKAA45YFyC3iXzYEXNxkboYJQ /XsOeh2UIs5o+N21V8eMOivhe2kaee1fG903o6NTrx/vhqLEntGtDyLt+O6Iy1bxTH r5nBrhzJ5zA4w== Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-57ea78e0618so5162064e87.0 for ; Mon, 13 Oct 2025 10:15:12 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCU/EnHOVuTB3mF8EkeadtdiPZjrcqyAAcV2w5weeljBoaSWjdmH4XNIdFZB84MHIHFTdtRjRVb/zyQe@vger.kernel.org X-Gm-Message-State: AOJu0YxodpsudfYjicfk8U0JaT7vRUKkdP+7bpLPEa6wstPUb0Opq+87 9KzkZYVAMMDfdFEzj3sDffYOL1rryyi8zsuJYpIZ5Sl+OJ326asySJs2wMy4X0NQUm2vUC8lxOo w0aPw3yob/qZ66S5P9uPve2Vns/RtRXBOWSZvKsZu X-Google-Smtp-Source: AGHT+IFe+SzxnNHmLcFlvnfkJvIZjwnZkm1Ok6JvoMYuj8nhVWXCmwvh0KaZdzeEUyoNuxcssWgKIbqhAnjyljsSJMw= X-Received: by 2002:a05:6512:230c:b0:573:68fd:7ad2 with SMTP id 2adb3069b0e04-5906dd53da9mr5881107e87.35.1760375710222; Mon, 13 Oct 2025 10:15:10 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20251013-getcpu_cache-v2-1-880fbfa3b7cc@linutronix.de> In-Reply-To: From: Andy Lutomirski Date: Mon, 13 Oct 2025 10:14:58 -0700 X-Gmail-Original-Message-ID: X-Gm-Features: AS18NWDGlHiZ6TxV2AYIYIygvwnW3vlieR2fC4dbq7adbnnZ1RUCMMYySi05JAY Message-ID: Subject: Re: [PATCH v2] vdso: Remove struct getcpu_cache To: Dave Hansen Cc: =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= , Huacai Chen , WANG Xuerui , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Richard Weinberger , Anton Ivanov , Johannes Berg , Vincenzo Frascino , Shuah Khan , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-um@lists.infradead.org, linux-api@vger.kernel.org, linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.2 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.2 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -11 On Mon, Oct 13, 2025 at 7:07=E2=80=AFAM Dave Hansen = wrote: > > On 10/13/25 02:20, Thomas Wei=C3=9Fschuh wrote: > > -int __vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu= _cache *unused); > > -int __vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu= _cache *unused) > > +int __vdso_getcpu(unsigned int *cpu, unsigned int *node, void *unused)= ; > > +int __vdso_getcpu(unsigned int *cpu, unsigned int *node, void *unused) > > { > > int cpu_id; > > It would ideally be nice to have a _bit_ more history on this about > how it became unused any why there is such high confidence that > userspace never tries to use it. The theory is that people thought that getcpu was going to be kind of slow, so userspace would allocate a little cache (IIRC per-thread) and pass it in, and the vDSO would do, well, something clever to return the right value. The something clever was probably based on the idea that you can't actually tell (in general) if the return value from getcpu is stale, since you might well get migrated right as the function returns anyway, so the cache could be something silly like (jiffies, cpu). I don't actually remember whether the kernel ever used this. It's possible that there are ancient kernels where passing a wild, non-null pointer would blow up. But it's certainly safe to pass null, and it's certainly safe for the kernel to ignore the parameter. --Andy > > Let's say someone comes along in a few years and wants to use this > 'unused' parameter. Could they? > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id 0Pk8EqMo7WiMHgMAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 16:28:19 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 16:28:19 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8LPH-00000000uTP-0Mm9 for hi@josie.lol; Mon, 13 Oct 2025 16:28:19 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 60D49541521 for ; Mon, 13 Oct 2025 16:20:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 057EC2797AC; Mon, 13 Oct 2025 16:16:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b="JQss/l/M" X-Original-To: linux-s390@vger.kernel.org Received: from mail.zytor.com (terminus.zytor.com [198.137.202.136]) (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 4372B322A; Mon, 13 Oct 2025 16:16:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.136 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760372179; cv=none; b=AZDDHuLBbxqxVerBibP5BSk83EB+ALwiK7PoY5rt/r6Eszk4uv5VPNhXoJvGGqLpsLbjW9+0jDXcOM9Uu5Wh7DYX6QeEFuFmh6hIghv3+8NHL3Es2U6MXG3hG1F5WgfxWlVxsBVq8nnPieJkRsNiT78n3UgaXBSRhklyTBOP2c8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760372179; c=relaxed/simple; bh=q4TWi+EHOJV5TC7Iymk26iR2c2LUySOZ0b50x1RvGCo=; h=Date:From:To:CC:Subject:In-Reply-To:References:Message-ID: MIME-Version:Content-Type; b=e0pMzxrfjZfgGjV++sYwlXKVSERVdFVu0XGp55xOzYFoL0V4prVDCMk8vaezj0D1bwkqIFei1gk8c1l4sY7qbdk8sEAcxq+25P93UUqVyJss5ydaFFOxoyXHn4sEHnzcssIsaWZLP09VFSTlTD6UEoYNxgtAFTiDJoLKJEFdm8E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com; spf=pass smtp.mailfrom=zytor.com; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b=JQss/l/M; arc=none smtp.client-ip=198.137.202.136 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zytor.com Received: from ehlo.thunderbird.net (c-76-133-66-138.hsd1.ca.comcast.net [76.133.66.138]) (authenticated bits=0) by mail.zytor.com (8.18.1/8.17.1) with ESMTPSA id 59DGEplg1360107 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Mon, 13 Oct 2025 09:14:52 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 59DGEplg1360107 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2025092201; t=1760372093; bh=MzpJMWVhNoOjgk4BJX8F1SShnKbckMn+Nc+zuR294Q0=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=JQss/l/MXShiySKzZWsav9VeArEu5N+uHoA047KLEMyntuwcMeK9wlN7HIQ0Tqk38 JWP3hXYKNvikpWfX6arlx9W0uwDMOxRmDNvKTDAE5F6UoQRuW2UYdQH8FS/dmu5d3E IWsydJI7iSqT/4JiUB/QpAvO0m3CLOT54r0BnuzOxjwp1hTkoYG5cC2cXMzIqbFFu/ hVeOMUm7eShn55+XGXxv1i0cXqiWlUTDXcOMz142IMJrmHCUqBtj9hGS3pSQf+YHB+ vjYWunPASD2OmpmvS1CGd8ToW6X150kS6ymSlNwqvCNTUzUlIQ4v/fyvlZZe23Moc7 PV1r9bSGOj9qg== Date: Mon, 13 Oct 2025 09:14:51 -0700 From: "H. Peter Anvin" To: Dave Hansen , =?ISO-8859-1?Q?Thomas_Wei=DFschuh?= , Huacai Chen , WANG Xuerui , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Richard Weinberger , Anton Ivanov , Johannes Berg , Vincenzo Frascino , Shuah Khan CC: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-um@lists.infradead.org, linux-api@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v2] vdso: Remove struct getcpu_cache User-Agent: K-9 Mail for Android In-Reply-To: References: <20251013-getcpu_cache-v2-1-880fbfa3b7cc@linutronix.de> Message-ID: <9F23DEFF-FCD7-488E-B31C-E891A7521D9E@zytor.com> Precedence: bulk X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-DKIM: signer='zytor.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: zytor.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On October 13, 2025 7:06:55 AM PDT, Dave Hansen = wrote: >On 10/13/25 02:20, Thomas Wei=C3=9Fschuh wrote: >> -int __vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu= _cache *unused); >> -int __vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu= _cache *unused) >> +int __vdso_getcpu(unsigned int *cpu, unsigned int *node, void *unused)= ; >> +int __vdso_getcpu(unsigned int *cpu, unsigned int *node, void *unused) >> { >> int cpu_id; > >It would ideally be nice to have a _bit_ more history on this about >how it became unused any why there is such high confidence that >userspace never tries to use it=2E > >Let's say someone comes along in a few years and wants to use this >'unused' parameter=2E Could they? I believe it was a private storage area for the kernel to use=2E=2E=2E whi= ch it doesn't=2E Not doing anything at all with the pointer is perfectly le= gitimate=2E From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id AKFwFpAH7WiyqjAAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 14:07:12 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 14:07:12 +0000 Received: from ams.mirrors.kernel.org ([213.196.21.55]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8JCh-0000000DZ7g-40ls for hi@josie.lol; Mon, 13 Oct 2025 14:07:12 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.mirrors.kernel.org (Postfix) with ESMTPS id 0D9B934CC6A for ; Mon, 13 Oct 2025 14:07:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0CA4B238C0D; Mon, 13 Oct 2025 14:06:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YaL1Lc2O" X-Original-To: linux-s390@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 68E671C84A6; Mon, 13 Oct 2025 14:06:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760364418; cv=none; b=SfjuymocayDfogZX0lcDM+sLKTNwA8pE1H8/BVrhDAQCG/F1z5F8HbytU9ULvoQjBaij9/5ClEWOK4RUgDkElxAFIj7m90bj9hNCu4ztOwj2uBKh+cidfzuNs/H7oLioVP+okwkFCp+D0HfNEHsYcSNMC4LdTPHEk+IbI0UmAn4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760364418; c=relaxed/simple; bh=L5mJoBb6ix5GBpByToQiDe5tqBFj7Zbr19ly3L1L3KI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=cMIwTdumXXebpCUDzIXCtMYnRKEzuvCH1qZwcdKWxwkBC5rWuzqDbz17uCOnNR2puuWQvfFnUkNXkUiiXaooP4HXkKWAp5vWQvylhHP0n/A+/Hq4xffL2+S04uFIYrpwv2RtKezaGm1X9i8MG+46GEbSbyEPxSVz1/Gul6aY5TM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=YaL1Lc2O; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1760364418; x=1791900418; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=L5mJoBb6ix5GBpByToQiDe5tqBFj7Zbr19ly3L1L3KI=; b=YaL1Lc2Omy7qI9scQjYqvVrPDt3IBuYgas97ODu3NZgxuPXDbBA/vBHI yjtewhM4xrSAaTlTwetf6Kg5VjKyxdtIGyIxfqG4TSREnr2umxtr5WwD0 4gERmaDzqqtue/XyWPCdEWcx1Nzp6qCCciFH/NqzRBNVs4Eb+vDBrRatr mvz/gq70YCjuyfbgTKiBVp2XqxqO90W0dw5WvGE+Fo054fdtFNBXRtj7Z dmTw4dzxCxDS7nBd2TYj9bJ8SNpZXwJF6dd6FsQ8aaDyLjWaAaT6T/NVL /cj1UbVeEHHA4UBZ4uX6JQTwBTUGwAo0CK6hRD5YQcLaNbJkmCbUBoVeH g==; X-CSE-ConnectionGUID: 4dC+1mT+RsyRHFucUrQ2vg== X-CSE-MsgGUID: wcOO+dXLQluY58daM+MB+A== X-IronPort-AV: E=McAfee;i="6800,10657,11581"; a="73946677" X-IronPort-AV: E=Sophos;i="6.19,225,1754982000"; d="scan'208";a="73946677" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2025 07:06:57 -0700 X-CSE-ConnectionGUID: uNRTtnxdRKStoMWW6widHg== X-CSE-MsgGUID: WCIV4fbYShWKbukyiTN2yA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,225,1754982000"; d="scan'208";a="186691282" Received: from aschofie-mobl2.amr.corp.intel.com (HELO [10.125.111.123]) ([10.125.111.123]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2025 07:06:57 -0700 Message-ID: Date: Mon, 13 Oct 2025 07:06:55 -0700 Precedence: bulk X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] vdso: Remove struct getcpu_cache To: =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= , Huacai Chen , WANG Xuerui , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Richard Weinberger , Anton Ivanov , Johannes Berg , Vincenzo Frascino , Shuah Khan Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-um@lists.infradead.org, linux-api@vger.kernel.org, linux-kselftest@vger.kernel.org References: <20251013-getcpu_cache-v2-1-880fbfa3b7cc@linutronix.de> From: Dave Hansen Content-Language: en-US Autocrypt: addr=dave.hansen@intel.com; keydata= xsFNBE6HMP0BEADIMA3XYkQfF3dwHlj58Yjsc4E5y5G67cfbt8dvaUq2fx1lR0K9h1bOI6fC oAiUXvGAOxPDsB/P6UEOISPpLl5IuYsSwAeZGkdQ5g6m1xq7AlDJQZddhr/1DC/nMVa/2BoY 2UnKuZuSBu7lgOE193+7Uks3416N2hTkyKUSNkduyoZ9F5twiBhxPJwPtn/wnch6n5RsoXsb ygOEDxLEsSk/7eyFycjE+btUtAWZtx+HseyaGfqkZK0Z9bT1lsaHecmB203xShwCPT49Blxz VOab8668QpaEOdLGhtvrVYVK7x4skyT3nGWcgDCl5/Vp3TWA4K+IofwvXzX2ON/Mj7aQwf5W iC+3nWC7q0uxKwwsddJ0Nu+dpA/UORQWa1NiAftEoSpk5+nUUi0WE+5DRm0H+TXKBWMGNCFn c6+EKg5zQaa8KqymHcOrSXNPmzJuXvDQ8uj2J8XuzCZfK4uy1+YdIr0yyEMI7mdh4KX50LO1 pmowEqDh7dLShTOif/7UtQYrzYq9cPnjU2ZW4qd5Qz2joSGTG9eCXLz5PRe5SqHxv6ljk8mb ApNuY7bOXO/A7T2j5RwXIlcmssqIjBcxsRRoIbpCwWWGjkYjzYCjgsNFL6rt4OL11OUF37wL QcTl7fbCGv53KfKPdYD5hcbguLKi/aCccJK18ZwNjFhqr4MliQARAQABzUVEYXZpZCBDaHJp c3RvcGhlciBIYW5zZW4gKEludGVsIFdvcmsgQWRkcmVzcykgPGRhdmUuaGFuc2VuQGludGVs LmNvbT7CwXgEEwECACIFAlQ+9J0CGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEGg1 lTBwyZKwLZUP/0dnbhDc229u2u6WtK1s1cSd9WsflGXGagkR6liJ4um3XCfYWDHvIdkHYC1t MNcVHFBwmQkawxsYvgO8kXT3SaFZe4ISfB4K4CL2qp4JO+nJdlFUbZI7cz/Td9z8nHjMcWYF IQuTsWOLs/LBMTs+ANumibtw6UkiGVD3dfHJAOPNApjVr+M0P/lVmTeP8w0uVcd2syiaU5jB aht9CYATn+ytFGWZnBEEQFnqcibIaOrmoBLu2b3fKJEd8Jp7NHDSIdrvrMjYynmc6sZKUqH2 I1qOevaa8jUg7wlLJAWGfIqnu85kkqrVOkbNbk4TPub7VOqA6qG5GCNEIv6ZY7HLYd/vAkVY E8Plzq/NwLAuOWxvGrOl7OPuwVeR4hBDfcrNb990MFPpjGgACzAZyjdmYoMu8j3/MAEW4P0z F5+EYJAOZ+z212y1pchNNauehORXgjrNKsZwxwKpPY9qb84E3O9KYpwfATsqOoQ6tTgr+1BR CCwP712H+E9U5HJ0iibN/CDZFVPL1bRerHziuwuQuvE0qWg0+0SChFe9oq0KAwEkVs6ZDMB2 P16MieEEQ6StQRlvy2YBv80L1TMl3T90Bo1UUn6ARXEpcbFE0/aORH/jEXcRteb+vuik5UGY 5TsyLYdPur3TXm7XDBdmmyQVJjnJKYK9AQxj95KlXLVO38lczsFNBFRjzmoBEACyAxbvUEhd GDGNg0JhDdezyTdN8C9BFsdxyTLnSH31NRiyp1QtuxvcqGZjb2trDVuCbIzRrgMZLVgo3upr MIOx1CXEgmn23Zhh0EpdVHM8IKx9Z7V0r+rrpRWFE8/wQZngKYVi49PGoZj50ZEifEJ5qn/H Nsp2+Y+bTUjDdgWMATg9DiFMyv8fvoqgNsNyrrZTnSgoLzdxr89FGHZCoSoAK8gfgFHuO54B lI8QOfPDG9WDPJ66HCodjTlBEr/Cwq6GruxS5i2Y33YVqxvFvDa1tUtl+iJ2SWKS9kCai2DR 3BwVONJEYSDQaven/EHMlY1q8Vln3lGPsS11vSUK3QcNJjmrgYxH5KsVsf6PNRj9mp8Z1kIG qjRx08+nnyStWC0gZH6NrYyS9rpqH3j+hA2WcI7De51L4Rv9pFwzp161mvtc6eC/GxaiUGuH BNAVP0PY0fqvIC68p3rLIAW3f97uv4ce2RSQ7LbsPsimOeCo/5vgS6YQsj83E+AipPr09Caj 0hloj+hFoqiticNpmsxdWKoOsV0PftcQvBCCYuhKbZV9s5hjt9qn8CE86A5g5KqDf83Fxqm/ vXKgHNFHE5zgXGZnrmaf6resQzbvJHO0Fb0CcIohzrpPaL3YepcLDoCCgElGMGQjdCcSQ+Ci FCRl0Bvyj1YZUql+ZkptgGjikQARAQABwsFfBBgBAgAJBQJUY85qAhsMAAoJEGg1lTBwyZKw l4IQAIKHs/9po4spZDFyfDjunimEhVHqlUt7ggR1Hsl/tkvTSze8pI1P6dGp2XW6AnH1iayn yRcoyT0ZJ+Zmm4xAH1zqKjWplzqdb/dO28qk0bPso8+1oPO8oDhLm1+tY+cOvufXkBTm+whm +AyNTjaCRt6aSMnA/QHVGSJ8grrTJCoACVNhnXg/R0g90g8iV8Q+IBZyDkG0tBThaDdw1B2l asInUTeb9EiVfL/Zjdg5VWiF9LL7iS+9hTeVdR09vThQ/DhVbCNxVk+DtyBHsjOKifrVsYep WpRGBIAu3bK8eXtyvrw1igWTNs2wazJ71+0z2jMzbclKAyRHKU9JdN6Hkkgr2nPb561yjcB8 sIq1pFXKyO+nKy6SZYxOvHxCcjk2fkw6UmPU6/j/nQlj2lfOAgNVKuDLothIxzi8pndB8Jju KktE5HJqUUMXePkAYIxEQ0mMc8Po7tuXdejgPMwgP7x65xtfEqI0RuzbUioFltsp1jUaRwQZ MTsCeQDdjpgHsj+P2ZDeEKCbma4m6Ez/YWs4+zDm1X8uZDkZcfQlD9NldbKDJEXLIjYWo1PH hYepSffIWPyvBMBTW2W5FRjJ4vLRrJSUoEfJuPQ3vW9Y73foyo/qFoURHO48AinGPZ7PC7TF vUaNOTjKedrqHkaOcqB185ahG2had0xnFsDPlx5y In-Reply-To: <20251013-getcpu_cache-v2-1-880fbfa3b7cc@linutronix.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-DKIM: signer='intel.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-DKIM: signer='@intel.com' status='pass' reason='' X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: intel.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [213.196.21.55 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: 4 On 10/13/25 02:20, Thomas Weißschuh wrote: > -int __vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *unused); > -int __vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *unused) > +int __vdso_getcpu(unsigned int *cpu, unsigned int *node, void *unused); > +int __vdso_getcpu(unsigned int *cpu, unsigned int *node, void *unused) > { > int cpu_id; It would ideally be nice to have a _bit_ more history on this about how it became unused any why there is such high confidence that userspace never tries to use it. Let's say someone comes along in a few years and wants to use this 'unused' parameter. Could they? From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id kMfoI3HE7GiOOAkAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 09:20:49 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 09:20:49 +0000 Received: from ams.mirrors.kernel.org ([213.196.21.55]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8EjY-00000003uIK-3qL8 for hi@josie.lol; Mon, 13 Oct 2025 09:20:49 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.mirrors.kernel.org (Postfix) with ESMTPS id 67FFE349643 for ; Mon, 13 Oct 2025 09:20:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D0F062FD7A8; Mon, 13 Oct 2025 09:20:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="mk8V5jjm"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="vUXxKwrE" X-Original-To: linux-s390@vger.kernel.org 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 7E5822FD1C6; Mon, 13 Oct 2025 09:20:41 +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=1760347244; cv=none; b=FCL2AXv0xwQmOeJX/mzOm/0GGwZa6fHyO3+GJO7AzKxSG4UxovIfie7vlwVcYmuZASeTFhBvtm6xEyv4mUSJk/QLL9H0BwbUzi7aWwdTGtzPnz8tPd8IbouPw6WPJSyCEVbt56sr/REb8BfUNcR/ODiLerLCaPFs7Idd2GLfyLM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760347244; c=relaxed/simple; bh=bsnyaBeSRCe8wdPqrrv1bwhb+qpEBLlt2hQJjqswvoc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=iaIbUZRKImAXH1DUVMZM/jWAmQEg0TWCYuUqBhwyeSaRPq03QAxIiADm4R42jyipI8mhCO50lXPpLJ4/nAm2HF/5i908pICeCvq9FjpRur6EMhvWOvFw1QmfOzEAzKSmzoSW5Wa1r5+su79P/rVUvvD9hnLotaDWj0ngXVett5M= 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=mk8V5jjm; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=vUXxKwrE; 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: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1760347238; 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: content-transfer-encoding:content-transfer-encoding; bh=YnHubzJu3Fgrg1zOT2N2oDqGxJhZGnOAfIAFA8L12bY=; b=mk8V5jjm9bjj/lAkYcJXLhq9kWnFEMuMqKTt5xMAfvc6r7I25XQWZiI0Gyrj9LJ6UEuFsS WhyEkJvj/FRcpITMyC7oMcXIR4ekUB5ijreDbz62kiwTawP9JM7Tj22HxuCx1mXTaFvY7a dJL/8r4ERZrH9ey8Op9ZqdRWXYXMDEkKsaxFX9HoLqMccXMC6j0eWD+WJ2NwEfCoDpJE8P 8T1ris271l+Ix9eZhFht6y7mcsl/ho4Ml7ldcbDCz5XNTsOhbJD1ICYW6d/g3ueeDqwiG/ cd53pLgexzGqbabCZMBGVrx4VmiH28i/cR9DYoqhPh20YYqDLV3mtIbK75ANaQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1760347238; 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: content-transfer-encoding:content-transfer-encoding; bh=YnHubzJu3Fgrg1zOT2N2oDqGxJhZGnOAfIAFA8L12bY=; b=vUXxKwrEAA6590TvF2FstxFKP8ixkPKIzOBbz2gBqmCDoZtEpCWNq87GBUWg8/VXdy20Hc iSOeNa9IIfXcJ5Bg== Date: Mon, 13 Oct 2025 11:20:37 +0200 Subject: [PATCH v2] vdso: Remove struct getcpu_cache Precedence: bulk X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20251013-getcpu_cache-v2-1-880fbfa3b7cc@linutronix.de> X-B4-Tracking: v=1; b=H4sIAGTE7GgC/1XMywqDMBCF4VeRWTfFibfQle9RpNg4moESJYlik bx7U6GLLv8D5zvAk2PycMsOcLSx59mmkJcMtOntRIKH1CBzWeVKVmKioJf1oXttSBT9Uw+S6qo sGkiXxdHI+8ndu9SGfZjd+9Q3/K4/qP6HNhQoVFOqAtVYY4nti+0a3Gx5vw4EXYzxAyTRuUCsA AAA X-Change-ID: 20250825-getcpu_cache-3abcd2e65437 To: Huacai Chen , WANG Xuerui , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Richard Weinberger , Anton Ivanov , Johannes Berg , Vincenzo Frascino , Shuah Khan Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-um@lists.infradead.org, linux-api@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1760347238; l=10000; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=bsnyaBeSRCe8wdPqrrv1bwhb+qpEBLlt2hQJjqswvoc=; b=htz+rIY3Hjtp1zl5kTi7ZVfgPQIb5MdOf2GL1NX2IOZxp5tyYiW4lMozgo3f4yL2dBq1J66kz lbkSRPPmIm/DtfVUa1j6yjutkcRFu8uuar9HdPD+gYKPvsRzxupRV/P X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= X-DKIM: signer='linutronix.de' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [213.196.21.55 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linutronix.de] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 The cache parameter of getcpu() is not used by the kernel and no user ever passes it in anyways. Remove the struct and its header. As a side-effect we get rid of an unwanted inclusion of the linux/ header namespace from vDSO code. Signed-off-by: Thomas Weißschuh --- Changes in v2: - Rebase on v6.18-rc1 - Link to v1: https://lore.kernel.org/r/20250826-getcpu_cache-v1-1-8748318f6141@linutronix.de --- We could also completely remove the parameter, but I am not sure if that is a good idea for syscalls and vDSO entrypoints. --- arch/loongarch/vdso/vgetcpu.c | 5 ++--- arch/s390/kernel/vdso64/getcpu.c | 3 +-- arch/s390/kernel/vdso64/vdso.h | 4 +--- arch/x86/entry/vdso/vgetcpu.c | 5 ++--- arch/x86/include/asm/vdso/processor.h | 4 +--- arch/x86/um/vdso/um_vdso.c | 7 +++---- include/linux/getcpu.h | 19 ------------------- include/linux/syscalls.h | 3 +-- kernel/sys.c | 4 +--- tools/testing/selftests/vDSO/vdso_test_getcpu.c | 4 +--- 10 files changed, 13 insertions(+), 45 deletions(-) diff --git a/arch/loongarch/vdso/vgetcpu.c b/arch/loongarch/vdso/vgetcpu.c index 5301cd9d0f839eb0fd7b73a1d36e80aaa75d5e76..aefba899873ed035d70766a95b0b6fea881e94df 100644 --- a/arch/loongarch/vdso/vgetcpu.c +++ b/arch/loongarch/vdso/vgetcpu.c @@ -4,7 +4,6 @@ */ #include -#include static __always_inline int read_cpu_id(void) { @@ -20,8 +19,8 @@ static __always_inline int read_cpu_id(void) } extern -int __vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *unused); -int __vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *unused) +int __vdso_getcpu(unsigned int *cpu, unsigned int *node, void *unused); +int __vdso_getcpu(unsigned int *cpu, unsigned int *node, void *unused) { int cpu_id; diff --git a/arch/s390/kernel/vdso64/getcpu.c b/arch/s390/kernel/vdso64/getcpu.c index 5c5d4a848b7669436e73df8e3b711e5b876eb3db..1e17665616c5fa766ca66c8de276b212528934bd 100644 --- a/arch/s390/kernel/vdso64/getcpu.c +++ b/arch/s390/kernel/vdso64/getcpu.c @@ -2,11 +2,10 @@ /* Copyright IBM Corp. 2020 */ #include -#include #include #include "vdso.h" -int __s390_vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused) +int __s390_vdso_getcpu(unsigned *cpu, unsigned *node, void *unused) { union tod_clock clk; diff --git a/arch/s390/kernel/vdso64/vdso.h b/arch/s390/kernel/vdso64/vdso.h index 9e5397e7b590a23c149ccc6043d0c0b0d5ea8457..cadd307d7a365cabf53f5c8d313be3718625533d 100644 --- a/arch/s390/kernel/vdso64/vdso.h +++ b/arch/s390/kernel/vdso64/vdso.h @@ -4,9 +4,7 @@ #include -struct getcpu_cache; - -int __s390_vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused); +int __s390_vdso_getcpu(unsigned *cpu, unsigned *node, void *unused); int __s390_vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz); int __s390_vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts); int __s390_vdso_clock_getres(clockid_t clock, struct __kernel_timespec *ts); diff --git a/arch/x86/entry/vdso/vgetcpu.c b/arch/x86/entry/vdso/vgetcpu.c index e4640306b2e3c95d74d73037ab6b09294b8e1d6c..6381b472b7c52487bccf3cbf0664c3d7a0e59699 100644 --- a/arch/x86/entry/vdso/vgetcpu.c +++ b/arch/x86/entry/vdso/vgetcpu.c @@ -6,17 +6,16 @@ */ #include -#include #include #include notrace long -__vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused) +__vdso_getcpu(unsigned *cpu, unsigned *node, void *unused) { vdso_read_cpunode(cpu, node); return 0; } -long getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache) +long getcpu(unsigned *cpu, unsigned *node, void *tcache) __attribute__((weak, alias("__vdso_getcpu"))); diff --git a/arch/x86/include/asm/vdso/processor.h b/arch/x86/include/asm/vdso/processor.h index 7000aeb59aa287e2119c3d43ab3eaf82befb59c4..93e0e24e5cb47f7b0056c13f2a7f2304ed4a0595 100644 --- a/arch/x86/include/asm/vdso/processor.h +++ b/arch/x86/include/asm/vdso/processor.h @@ -18,9 +18,7 @@ static __always_inline void cpu_relax(void) native_pause(); } -struct getcpu_cache; - -notrace long __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused); +notrace long __vdso_getcpu(unsigned *cpu, unsigned *node, void *unused); #endif /* __ASSEMBLER__ */ diff --git a/arch/x86/um/vdso/um_vdso.c b/arch/x86/um/vdso/um_vdso.c index cbae2584124fd0ff0f9d240c33fefb8d213c84cd..9aa2c62cce6b7a07bbaf8441014d347162d1950d 100644 --- a/arch/x86/um/vdso/um_vdso.c +++ b/arch/x86/um/vdso/um_vdso.c @@ -10,14 +10,13 @@ #define DISABLE_BRANCH_PROFILING #include -#include #include /* workaround for -Wmissing-prototypes warnings */ int __vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts); int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz); __kernel_old_time_t __vdso_time(__kernel_old_time_t *t); -long __vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *unused); +long __vdso_getcpu(unsigned int *cpu, unsigned int *node, void *unused); int __vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts) { @@ -60,7 +59,7 @@ __kernel_old_time_t __vdso_time(__kernel_old_time_t *t) __kernel_old_time_t time(__kernel_old_time_t *t) __attribute__((weak, alias("__vdso_time"))); long -__vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *unused) +__vdso_getcpu(unsigned int *cpu, unsigned int *node, void *unused) { /* * UML does not support SMP, we can cheat here. :) @@ -74,5 +73,5 @@ __vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *unused return 0; } -long getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *tcache) +long getcpu(unsigned int *cpu, unsigned int *node, void *tcache) __attribute__((weak, alias("__vdso_getcpu"))); diff --git a/include/linux/getcpu.h b/include/linux/getcpu.h deleted file mode 100644 index c304dcdb4eac2a9117080e6a14f4e3f28d07fd56..0000000000000000000000000000000000000000 --- a/include/linux/getcpu.h +++ /dev/null @@ -1,19 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _LINUX_GETCPU_H -#define _LINUX_GETCPU_H 1 - -/* Cache for getcpu() to speed it up. Results might be a short time - out of date, but will be faster. - - User programs should not refer to the contents of this structure. - I repeat they should not refer to it. If they do they will break - in future kernels. - - It is only a private cache for vgetcpu(). It will change in future kernels. - The user program must store this information per thread (__thread) - If you want 100% accurate information pass NULL instead. */ -struct getcpu_cache { - unsigned long blob[128 / sizeof(long)]; -}; - -#endif diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 66c06fcdfe19e27b99eb9a187c22e022e260802f..403488e5eba906ecf40975fc3cb29ed0402491f2 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -59,7 +59,6 @@ struct compat_stat; struct old_timeval32; struct robust_list_head; struct futex_waitv; -struct getcpu_cache; struct old_linux_dirent; struct perf_event_attr; struct file_handle; @@ -714,7 +713,7 @@ asmlinkage long sys_getrusage(int who, struct rusage __user *ru); asmlinkage long sys_umask(int mask); asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5); -asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache); +asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, void __user *cache); asmlinkage long sys_gettimeofday(struct __kernel_old_timeval __user *tv, struct timezone __user *tz); asmlinkage long sys_settimeofday(struct __kernel_old_timeval __user *tv, diff --git a/kernel/sys.c b/kernel/sys.c index 8b58eece4e580b883d19bb1336aff627ae783a4d..f1780ab132a3fbce6aac937ade5b9a35d9837f13 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -2876,8 +2875,7 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, return error; } -SYSCALL_DEFINE3(getcpu, unsigned __user *, cpup, unsigned __user *, nodep, - struct getcpu_cache __user *, unused) +SYSCALL_DEFINE3(getcpu, unsigned __user *, cpup, unsigned __user *, nodep, void __user *, unused) { int err = 0; int cpu = raw_smp_processor_id(); diff --git a/tools/testing/selftests/vDSO/vdso_test_getcpu.c b/tools/testing/selftests/vDSO/vdso_test_getcpu.c index cdeaed45fb26c61f6314c58fe1b71fa0be3c0108..994ce569dc37c6689b1a3c79156e3dfc8bf27f22 100644 --- a/tools/testing/selftests/vDSO/vdso_test_getcpu.c +++ b/tools/testing/selftests/vDSO/vdso_test_getcpu.c @@ -16,9 +16,7 @@ #include "vdso_config.h" #include "vdso_call.h" -struct getcpu_cache; -typedef long (*getcpu_t)(unsigned int *, unsigned int *, - struct getcpu_cache *); +typedef long (*getcpu_t)(unsigned int *, unsigned int *, void *); int main(int argc, char **argv) { --- base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787 change-id: 20250825-getcpu_cache-3abcd2e65437 Best regards, -- Thomas Weißschuh From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id IPJ9Mysd7mj+EAEAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 09:51:39 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 09:51:39 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8bgx-00000000Wfq-0x6b for hi@josie.lol; Tue, 14 Oct 2025 09:51:39 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id AB2484FC3D8 for ; Tue, 14 Oct 2025 09:51:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F13E32EA464; Tue, 14 Oct 2025 09:50:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="GPcpshgQ" X-Original-To: stable@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 959BA2E2EF8; Tue, 14 Oct 2025 09:50:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760435447; cv=none; b=ux7NHsyGsa+3QdekWW7DD3b4lIcjcdGj1Qc9xWCG38KHMmsN4uGFe1ksOI0aiiOHYHnZQ+4EXzWjZshH2hCR0PUIvEtANX63PApcfyaZazZvz8dxhO3Z1VW97F3dGjJI2GLygyI0s/5DEyLjTmNJhkGFJGkLWHPePTq838KYsKc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760435447; c=relaxed/simple; bh=mTnPuwprhL1kApju2BghnqenrZrPLPzmn0K030R5TPw=; h=From:Date:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=SNquV4F/PyRq8wefeM4ph8j5w7mjRbv1Um4Bu3Xq1xSR7H+DS79lzW7dXARG3qKnOGsmiazxx2pLwKS45v9HtUmt5x8eKfVQmriByA+6mNO0vJiidyH2yUnE0vCbp+Flon9SUGk5wu3IIk3vZsMtxYMH1ln9qllkpJsjVbFEsw0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=GPcpshgQ; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1760435446; x=1791971446; h=from:date:to:cc:subject:in-reply-to:message-id: references:mime-version:content-id; bh=mTnPuwprhL1kApju2BghnqenrZrPLPzmn0K030R5TPw=; b=GPcpshgQ+O0Ld0u0vl2cZiNCDj56pQW7TvLhytZx+nqfWNtbfkApy0QQ /n+2RCTKhGy2gVkUsggplsHXigA1qGpxttuPd9/4kCTvnjnvD+reiiuYm lIsXIPlkTizZdSqweLzfptnhfUUejdPp5nVOoBkB0riYbb1LYSdo8bFQ7 aMnxl7WZwEKqGq87kMZGelim152bnyp8pGQNejTt1OvOzXbkkbT6YN/QF KqHsSV1EI/mpkmWU3juRQofS8rtUfibVOqfyC593KrW83fcmeHogI8imV Q7Cz89cYt03fBEbbJ7Q0r+GWjMMETDaMIkBRHRlj6gVkntawdVdhY5mBq A==; X-CSE-ConnectionGUID: bpL1c0R/Q9STkuCxpuETlQ== X-CSE-MsgGUID: URKXQEZLTcCBbZYpK4di6A== X-IronPort-AV: E=McAfee;i="6800,10657,11581"; a="73193327" X-IronPort-AV: E=Sophos;i="6.19,227,1754982000"; d="scan'208";a="73193327" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2025 02:50:45 -0700 X-CSE-ConnectionGUID: Q4wwLd30ThS1aG8wkyNp+g== X-CSE-MsgGUID: yQbLQctcSzuWh6NXhOpPHg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,227,1754982000"; d="scan'208";a="181847204" Received: from ijarvine-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.244.195]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2025 02:50:41 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Tue, 14 Oct 2025 12:50:38 +0300 (EEST) To: Kurt Borja cc: Hans de Goede , Armin Wolf , platform-driver-x86@vger.kernel.org, Dell.Client.Kernel@dell.com, LKML , stable@vger.kernel.org, Gal Hammer Subject: Re: [PATCH v2] platform/x86: alienware-wmi-wmax: Fix null pointer derefence in sleep handlers In-Reply-To: Message-ID: <305092f3-7901-0a69-3459-b9f6b7d198db@linux.intel.com> References: <20251013-sleep-fix-v2-1-1ad8bdb79585@gmail.com> <176036823039.2473.15648931584117338012.b4-ty@linux.intel.com> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323328-1269750449-1760435378=:925" Content-ID: <720f1d53-260f-ad44-3ffd-d73277d83ce0@linux.intel.com> X-DKIM: signer='intel.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-DKIM: signer='@intel.com' status='pass' reason='' X-Spam-Score: 0.5 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: intel.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: 5 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323328-1269750449-1760435378=:925 Content-Type: text/plain; CHARSET=ISO-8859-15 Content-Transfer-Encoding: QUOTED-PRINTABLE Content-ID: <0d969903-4d6a-9b29-ca27-daa7053c6c78@linux.intel.com> On Tue, 14 Oct 2025, Kurt Borja wrote: > On Mon Oct 13, 2025 at 10:10 AM -05, Ilpo J=E4rvinen wrote: > > On Mon, 13 Oct 2025 00:26:26 -0500, Kurt Borja wrote: > > > >> Initialize `awcc` with empty quirks to avoid a null pointer dereferenc= e > >> in sleep handlers for devices without the AWCC interface. > >>=20 > >> This also allows some code simplification in alienware_wmax_wmi_init()= =2E > >>=20 > >>=20 > > > > > > Thank you for your contribution, it has been applied to my local > > review-ilpo-fixes branch. Note it will show up in the public > > platform-drivers-x86/review-ilpo-fixes branch only once I've pushed my > > local branch there, which might take a while. > > > > The list of commits applied: > > [1/1] platform/x86: alienware-wmi-wmax: Fix null pointer derefence in s= leep handlers > > commit: 5ae9382ac3c56d044ed065d0ba6d8c42139a8f98 > > > > -- > > i. >=20 > Hi Ilpo, >=20 > Gal has just noticed this approach prevents the old driver interface > from loading, which is a huge regression. >=20 > Do you prefer to drop this commit or should I submit a revert? >=20 > Thank you for your patience! Okay, thanks for the information. I'll drop it, it's very easy to drop as= =20 it's the HEAD commit. --=20 i. --8323328-1269750449-1760435378=:925-- From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id ELNHE8Mc7micoD0AYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 09:49:55 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 09:49:55 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8bfH-00000000TJa-0Qp8 for hi@josie.lol; Tue, 14 Oct 2025 09:49:55 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id CBC704FCC56 for ; Tue, 14 Oct 2025 09:49:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 282DA302CCA; Tue, 14 Oct 2025 09:48:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ClkgYJg3" X-Original-To: stable@vger.kernel.org Received: from mail-vk1-f176.google.com (mail-vk1-f176.google.com [209.85.221.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37792220686 for ; Tue, 14 Oct 2025 09:48:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760435313; cv=none; b=lZjEpcRzm0IiL0KPWNccH+50PJBB41Cfd7tKcs61nn2+7f2wl01OTrlgF+ZF17HZeEHPClfIYe5DoVrImNxXG/eiDe4yBz/TMDKutGOwfWiTXV1w+gjpFwyMxgob3vaVYLKp4XZWK64CHXorHAmAOktMEH8iJd0Ax5I8A73GZbY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760435313; c=relaxed/simple; bh=kHtxBRJjtARoemyv0wYK4lb2xYVXtiqIKZY9jw9d9PU=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:From:To:Cc: References:In-Reply-To; b=I3o5yPxzQWEinBK7hsEgmpQ0y7zQyytOfCYgwjVNV+BXA2ga0gfQdlbZQ7mXc6JjvxjYW98M4LAh8TT9tLY7SX3CsXJ95kVEpb+c7daNUDAJCiOoWT3d1VgIYurRLII8cuOSflBUU7ZddQie7jQ6ZnOHQF4nz7C1CEgZopfd2wU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ClkgYJg3; arc=none smtp.client-ip=209.85.221.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-vk1-f176.google.com with SMTP id 71dfb90a1353d-54aa30f4093so1681800e0c.3 for ; Tue, 14 Oct 2025 02:48:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760435310; x=1761040110; darn=vger.kernel.org; h=in-reply-to:references:cc:to:from:subject:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=LG0ED4pWkkVj5n94lraCEC5DO5yZd4ntTF5w7MamzsU=; b=ClkgYJg3ZFFg/dqfrMmCuaIbGbomsnLKgHgxxwSFZsR7yXtwgtmGUoS+2XAMqDzDVv vLXfo7iY76PzIxEpm1iPMkDS21jCur0PYugttmX6/ngvGWGLqaOwIAAFdikhGSyMRx23 r+XrXloDipTpfiI+JV48nbZCo1tfT+vQ0DoVkGeWS+nUL3RQlLvfFz7vCX42TvCrYskn 6hq0+qhMWwMENx5F2hJ4GFU3ksYXhMuhQnn750VklgpMKdAGoKUDitPnBinOol2itdaJ UL4VUM1f+GByKDnR7ZWyh3NrqSFJcSttBhdLbJ+4OQkdEXj8L7mqAj90jCsH35iR6Ymb u9MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760435310; x=1761040110; h=in-reply-to:references:cc:to:from:subject:message-id:date :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=LG0ED4pWkkVj5n94lraCEC5DO5yZd4ntTF5w7MamzsU=; b=WPiksx/wtkBoKnHt0nLmiAwisalFCYWkk72JXogeRD5hGnbPIyYHaaH/J1e9whA8oz xRhyNwAXutbHM5U4IFhZxjZiBzQ5Pe05fFnJ4BggTI2L34MdBfIU+FZCDWZfLb+82v7t CHI13BjDLBkgWXedmRj7blisEmK+w1iWICObEILEfBXr+Ix3GBoHzMI+5SJT4JNaJ3eB Ra38cse0sE6FQPxM6iv82ojcYs5YShSc3+eu2AXjfXKfTB7inYLbweFr8ofEjar0oklp 41vsbY10eaUp/opnGlR3fXVOPl+CgCjif6kqJkV7mOJza1ECHe4CsKBcnO7Cqv6ILeiN ncBA== X-Forwarded-Encrypted: i=1; AJvYcCUUOs3Qv4X/IM+PLKuvUWa1MMCeMJ2F0G8DUHxFZkO8S9wZu7hX1Wcb/uHNioWUwo9Qvk1VWIE=@vger.kernel.org X-Gm-Message-State: AOJu0YwDGoRYsy4dMCF3n2Eypfxw1CheTL38t6/8J8ythQGTJXEE8rQC r5nEFFWbMvTwPIkjjOKf1G8t9r8BJRk9Hci0nYlVSSPRgKdKIM1oF70Q X-Gm-Gg: ASbGncsCCg/CfmfYRbT3r2z1geZwgaJTNxNvX6m8Qqfvf50RkecpSNtJhd+Qwf8gDVK ow1dqqC7weDyqOrLA5Zd1ud6nxSLXAAOs4ImGJuJY7owq3NhDdS2hnTKSJbZz/6LsXNE8X1QlP5 UMw6m1RCjuOxRNM+eXDpWuGoLT5ASkjjzKPgqhmqaEgEq5QgoXhu6j/LVu+qdvXnrpih185jjjd rby1dWidCDCxhMGBC9+p6w/rH5MEK7WcSE5QBDEaNhzlkpoMWVe+/SsfIDZnKbYMpgzTLWGJa79 b0qhINWgdD4gP7Q5LK+lBxMpvCTjLb+5KMNpABsjAwXXRZ3fvWVjWohNpPKjm2OCRAaGkUDMeIp sX6Q5HF0+a+UlOSa1jB0lcyowzmRIK29hEQQU+veUYJFG X-Google-Smtp-Source: AGHT+IF6H47KZGz8Lq6nVOeRN/dL+wwxgitHPIZLOq8wuKUhsfrWL6NL4IjUjZ54gMcdy/8Rww7YmQ== X-Received: by 2002:a05:6102:2acd:b0:5d5:fefc:9fd0 with SMTP id ada2fe7eead31-5d5fefca0d5mr4008750137.0.1760435310123; Tue, 14 Oct 2025 02:48:30 -0700 (PDT) Received: from localhost ([2800:bf0:82:3d2:875c:6c76:e06b:3095]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-930bf6ce034sm3474678241.7.2025.10.14.02.48.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Oct 2025 02:48:29 -0700 (PDT) Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 14 Oct 2025 04:48:28 -0500 Message-Id: Subject: Re: [PATCH v2] platform/x86: alienware-wmi-wmax: Fix null pointer derefence in sleep handlers From: "Kurt Borja" To: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Hans de Goede" , "Armin Wolf" , "Kurt Borja" Cc: , , , , "Gal Hammer" X-Mailer: aerc 0.21.0-0-g5549850facc2 References: <20251013-sleep-fix-v2-1-1ad8bdb79585@gmail.com> <176036823039.2473.15648931584117338012.b4-ty@linux.intel.com> In-Reply-To: <176036823039.2473.15648931584117338012.b4-ty@linux.intel.com> X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [kuurtb[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On Mon Oct 13, 2025 at 10:10 AM -05, Ilpo J=C3=A4rvinen wrote: > On Mon, 13 Oct 2025 00:26:26 -0500, Kurt Borja wrote: > >> Initialize `awcc` with empty quirks to avoid a null pointer dereference >> in sleep handlers for devices without the AWCC interface. >>=20 >> This also allows some code simplification in alienware_wmax_wmi_init(). >>=20 >>=20 > > > Thank you for your contribution, it has been applied to my local > review-ilpo-fixes branch. Note it will show up in the public > platform-drivers-x86/review-ilpo-fixes branch only once I've pushed my > local branch there, which might take a while. > > The list of commits applied: > [1/1] platform/x86: alienware-wmi-wmax: Fix null pointer derefence in sle= ep handlers > commit: 5ae9382ac3c56d044ed065d0ba6d8c42139a8f98 > > -- > i. Hi Ilpo, Gal has just noticed this approach prevents the old driver interface from loading, which is a huge regression. Do you prefer to drop this commit or should I submit a revert? Thank you for your patience! --=20 ~ Kurt From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id CDzlEncH7mgCLjYAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 08:19:03 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 08:19:03 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8aFK-0000000F0V0-3YZW for hi@josie.lol; Tue, 14 Oct 2025 08:19:03 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BE9DE4021FB for ; Tue, 14 Oct 2025 08:19:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6FA812DCBF3; Tue, 14 Oct 2025 08:18:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="adsibxpF" X-Original-To: stable@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (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 1768C221703; Tue, 14 Oct 2025 08:18:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760429939; cv=none; b=lh0xmRaRxmAqCwwmDijQIG4PlTowFFAwy4idNVFBFGq4B7vYDLiL2GKzzvcvDD1RcFFb7OE3SHbiD+4KSBRs9WPpJcWl9ae9PczshtM7ybBYFvhftePQjzsHaiHzXfQi5jgrobR226tidAxenBEYpSa2KkURcLQNVc9I6wxNQm8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760429939; c=relaxed/simple; bh=YdHjqTNgP74jckAY3AUrjqsDyYyjvpD259UQSVwnYKc=; h=From:Date:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=isoikURXmgfaWRzUDwCpv8D2sRwBhj5KfQJybgCQlSkbdI72NDN97SyDql3/R3AbPvY7LnofmkDNyAbbccj2Y5Mrz9XhDlcDoxd81HYwV6hCCaO3mG+Fhco0fJirtvsAgNWkgIaBddOksOt3aCmNg96dRnxcMfsuWkSMARz2zQU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=adsibxpF; arc=none smtp.client-ip=198.175.65.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1760429937; x=1791965937; h=from:date:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=YdHjqTNgP74jckAY3AUrjqsDyYyjvpD259UQSVwnYKc=; b=adsibxpFRBFrei047J2MFo2tgk3Hrp+XYPbzISaElDqK+hBeIIqAgWhf cPqqnDG0pVUS5j2+hipA0HoEDwN0+Ifs4RzcQlB85bt5pOllSAeU1pEBj fTnkNhifn9lNo1v5kOpLqJGz0VrkOxDzw3u+UWKrE+yr6NlWe4txey3cD cLA9tm10e5pvnFibVbXhqNOvB4sE6JU6QVgSesdpTOqUB+mfjxmX75vsS Q/+edr5G0KIx4ofOHHTrssLdIenAgMRZC88mczg90k1ZZFseGVPRo/gMR kyHaOVPd1NCd/UmO8nMkimbW4i5YH9fIFOdzXjj1sJ59Klw74ZsuCHYjt A==; X-CSE-ConnectionGUID: VjnRXY4ZSLi+SHX6s+TMTA== X-CSE-MsgGUID: eTE6iek7SxyZ/plZOxtCJQ== X-IronPort-AV: E=McAfee;i="6800,10657,11581"; a="62733623" X-IronPort-AV: E=Sophos;i="6.19,227,1754982000"; d="scan'208";a="62733623" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2025 01:18:56 -0700 X-CSE-ConnectionGUID: rDR0MUa9QeGjXTn5n7hfxQ== X-CSE-MsgGUID: T5E+1zUeQ8eiX6T/PqpYPg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,227,1754982000"; d="scan'208";a="186237930" Received: from bergbenj-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.244.195]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2025 01:18:52 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Tue, 14 Oct 2025 11:18:49 +0300 (EEST) To: Markus Elfring cc: Kurt Borja , platform-driver-x86@vger.kernel.org, Armin Wolf , Hans de Goede , Dell.Client.Kernel@dell.com, stable@vger.kernel.org, LKML , Gal Hammer Subject: Re: [v2] platform/x86: alienware-wmi-wmax: Fix null pointer derefence in sleep handlers In-Reply-To: <1e179db8-1c44-4bda-ba07-1be2195febae@web.de> Message-ID: <2007c648-1a39-f458-41a0-fcda54f9d5b5@linux.intel.com> References: <176036823039.2473.15648931584117338012.b4-ty@linux.intel.com> <1e179db8-1c44-4bda-ba07-1be2195febae@web.de> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323328-1534069840-1760429929=:925" X-DKIM: signer='intel.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-DKIM: signer='@intel.com' status='pass' reason='' X-Spam-Score: 0.5 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: intel.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: 5 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323328-1534069840-1760429929=:925 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Mon, 13 Oct 2025, Markus Elfring wrote: > =E2=80=A6 > > The list of commits applied: > > [1/1] platform/x86: alienware-wmi-wmax: Fix null pointer derefence in s= leep handlers >=20 > dereference? >=20 >=20 > > commit: 5ae9382ac3c56d044ed065d0ba6d8c42139a8f98 >=20 > How do you think about to avoid a typo in the summary phrase? Thanks for noticing it. I've corrected it now. --=20 i. --8323328-1534069840-1760429929=:925-- From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id mLFMMsJS7Wh7uxkAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 19:28:02 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 19:28:02 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8ODC-00000007BkG-0tuB for hi@josie.lol; Mon, 13 Oct 2025 19:28:02 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 000314E1FD1 for ; Mon, 13 Oct 2025 19:28:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 64A012D9EDF; Mon, 13 Oct 2025 19:27:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="PtjU3oVT" X-Original-To: stable@vger.kernel.org Received: from mout.web.de (mout.web.de [212.227.15.3]) (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 E42C62472BD; Mon, 13 Oct 2025 19:27:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.15.3 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760383678; cv=none; b=spzXje9QNVIJgGrpvjEXueKNCKMbLwctC2W6yrWj4lhBuCr5PAI2Hwe0Ql5tjJsENviHw2TqsfxxhCbaMPB1EcCft+TaD/8av+rap8UJZDbN+MBuL091aRm6D5IOwcVLJTLNIrJjRTO7NCG+EimZxy8wNTH0BHsV4RJY1TzDqNU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760383678; c=relaxed/simple; bh=cjM4rroTyA0Y98QpmyFJPTeJ9E+1tSQ+lxNOQ8eUGWY=; h=Message-ID:Date:MIME-Version:To:Cc:References:Subject:From: In-Reply-To:Content-Type; b=SionWSF6CWucQsIuTLBkmvNyAbkoxNwPztEFM38EU/JVPxaF+AZBj/+YPXpRePxo/S5DoqM05d3k0Z6L8zOo8lRRe721XnUXN5J/zkq5AE1F1KwKKXpIjuUM/TDhonf9XUtI065rmf5XqPcE8eKVRR9zHv+W4eo9KSCuElfEXq4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de; spf=pass smtp.mailfrom=web.de; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b=PtjU3oVT; arc=none smtp.client-ip=212.227.15.3 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1760383654; x=1760988454; i=markus.elfring@web.de; bh=3QnAgP08nLzueYfQi3GJhp59EsLXxNcSxa6wb4iaBaw=; h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:To:Cc:References: Subject:From:In-Reply-To:Content-Type:Content-Transfer-Encoding: cc:content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=PtjU3oVTj9Jl7FhbNp17gAJwNoEmqv5CwaepEGLzD8CGlHJpw58H3IXcrdo/pAIm 9ghVXkxEtm35iLMQqnmYb86VNsMnv4Wf1PN7Qe5J4dJqe6PJd/YSJaDcaTRJbtzLW euvr0LztwT0cWkm/U5XEHJphMTkJwSJH5EA5IURiKmYz+6VWV4oGqO2R3+Xbl+H94 EORTZKg6Lstnk/bVkOX4wGSpIQzHCK8Qqu0LHxf6i1f1tmRc3bpMthF33dUzlE0om sMDz9CXBY/LBAEZRLqd2YOVDX1AS4fMF8syNELlNM7KZrjbqfoyzVuhN9tBB0O7ZL Uc88zQ4xD5zsto/1xw== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.29] ([94.31.69.175]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1M604t-1vAr3F3KOJ-00C9B5; Mon, 13 Oct 2025 21:27:34 +0200 Message-ID: <1e179db8-1c44-4bda-ba07-1be2195febae@web.de> Date: Mon, 13 Oct 2025 21:27:26 +0200 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , Kurt Borja , platform-driver-x86@vger.kernel.org, Armin Wolf , Hans de Goede Cc: Dell.Client.Kernel@dell.com, stable@vger.kernel.org, LKML , Gal Hammer References: <176036823039.2473.15648931584117338012.b4-ty@linux.intel.com> Subject: Re: [v2] platform/x86: alienware-wmi-wmax: Fix null pointer derefence in sleep handlers Content-Language: en-GB, de-DE From: Markus Elfring In-Reply-To: <176036823039.2473.15648931584117338012.b4-ty@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:slXag5l1I8SFLPhkGzNXQlmohLNzYbsv06HdeQ0RmOEY0lKRau7 w5Xs3Qsd2v7SkHIsWooXUaqitvxVkANgyZBwMgqx+j3TSYLQ/glfahFATRSrFb7zKXzAuSv bF5bm2lpPC4AHsHaqylOq/0Kmv6NhJRfrHAt/VdsoRyBnKldCDCuXlWiJWSSrtzBVmCj5N7 d2aQm/g/9UxxjLPJilJgg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:EEo8Xnkso2U=;2lZz07CKUHFGA2t8EOqlal2ywOG RTz2sbzaIB0moGYU44wlquOQu+StZhWCjYaD6qvfj8NxDSRwVseoiY5U83a8DmH3fRf219wmf P+yIWD5FYVvr3639Kr3fSDlkW/hZj4c46JRpFTvTG7USkLyl/MS4qw+BCkRCDqZu/f1XHsUAa wUqRmW7rKmTvuhodt5HpDbZ/R2GC9L0B52DvAUbYagte7yHhEs1CswQOPUVtRuBGyaEw1wraF Ge9JU2UlHU+qtsuHp3V71N2gzCALCcTzMb/L1WesWVqasuX6ah0W0E8jg/CkMhtEslHEvL7AQ MyMCYIyRjg+Mq0O1ryclsUCv5TtBSmPXl0LuGtNwHa7/NtY/BlZWwDDrWzeeTvec9nIPeb1uZ 6D70gKNLZN/P6YPfhOQG+7YyBXUL11pOQ7EGqIndvePI9TDMwiFhie4OUizFGU2stYOF6kVLK itcp8REmlSON6CX7DkZO9WfnRgUJC14efqpygj1GQlUQZCpZb2ynhEKXKLZsOV5+hJE+Tp8TK MF5p9VwyEhw3PsfGifWVKCQjNUQ4aGwN9rdYCsqF/MkHlJnSSx5QNxe6XZOwI6EGkct0CTRv6 y1N3Hl2I6n+QqEy5HKL+sbvD6u1WRSdlyVZsBJ3vIiwLOA465fetopWc+IDN8FXHyULnNjMnv N2ORffVRfzUJYh69kJ/GadF84VhOdEqO+sXABfjUvUDSVKgOt5haYkSi0S7EK1WYP3CqJZ30A 0F4rkdmnj7vCDpuQprEDMvYv5s4fAqOvaeLay5KC/BFQvRZMDMjBybXJknKm1USCqq/Ru6HJl ONPSauLgFUY8n+DLz00hkOl2ovtE1RWrdQ47VzXrYA7pOGp2hL7Qh0SygHeI8viFdjr/Fgl6r Dye+tX5R0yViWpK02eeEC9Sp1WLc/kxsDd2zljS9nKXatGhPehBoDDfqZ+41zc6J1GrskZs6Z s1cAUVwJoVBzzFI7o22FAonet2QkkdcePTot176ewftEfwg67gTJDMsCaWQ6LDGYihKaP7fPH geTL+LUumG7jvFk5FZl/qpOgn70BD00p28j7VVuR8vlTHqWPMlRt7ncLA6wh/z5Z00NYV6FGf vs+SBDu+C7zXDiVhNk8q5w/T6ypWN9En3R+5lg4dEqXmvGa3Mkp5ZZUX5HrFqB7CuFylF85iX 6Dij9trjhvnvOS7YZnJ7iBhOUY0SS9QuiuhA7j7FfiE3jffcq/fPbsZd0U+2NSBsnjJYvR16N 2WJTXt41xlaoIkMmfIn+DjSl5/M7URzLtfMqnmQLKbG04TYjkJBtpQwjrIRUBQX94/6mJ/6Vl wg1JAMsvT7qQ5NovzQjO8CyyCjtrJhZF4lq0k2UDWZ5L10FnjyWEDfWo000RzGWdS64cpcE+q FAiP8BZgT4e6U+0EWV2anrvCBMRosOoDMOtLsRRDtwEJ8kE52rc+4BnVNojCQM/NBMsXTWQpb hC7wm9j17NR4CVcg6Y79PHm56Hw1rHLGLqBl17xczzT1LNhm6JGPKvesZyjB8kcVKm136m2kh J0lIM2JwdqgtsaRMTAWaLQp5zNoi6jl769Pst634nHOHrmDdPPk0WM9IDQDs09GsssLk4UuSe Jd3UZR51W4WhE3HXR5ERSNH5sd3WpXzw93jrZvB3I9w3+lOfPCJOPQq4YK7vz8NMjel0EaWiX IBq5C1XReU5xM83h372had/BUz9VJOLNdJRmURmA00BS4YJZa/tfdVp5wa2HWm74k/rTwF0IJ SAzrRqyPKQOeXSqL0Mn4xZS1L1chRWQ1KGLEcH8+KRICRKEkPopRd/8NJQZbyZL3ZNMEGReuI 3T68AZUWK5GznJk67EnapWH0Gvcc+JEUDLx3Yp2FhOPruSX4PVwn2l6PS+yNigCi8Z4RmDvlL end52gUBOUEurIoTIm9yaQCcyzraSQffXwP0v1GTXpnklRAP3wB1MxVM9DHY+4CUtBRnl/BuT 4+FOXeoDXPfkcES10CxsmjS/PGbz6yH4aJEb8QBQoX3dPdnV0BlLFYNLpfVWgf+NcgJAdVykx 0wefVCuJ0x+tF/RFQMczMJn/slZ8pAxgWqWiKyVesrYMyoaABj6ptetMX1KdicPEQcrtLvdlP njtefKw3XSBDdu0aw6xfdfn/jZgFZAj/4fDQocF5m98HBzFCY4MYVOR6rMvj/1ekMoZ6T+UUm CuPYsBkYa29Aajz4wTsLycZRaTOdICtWi05gC8rmJ6hVhMUgfsSWrrSlqGqW3c5hLPBzI4wcV LhkROrfoG5oYLsW62TX1JqjvCB+drZIctpXsrGSjXqVkrJEyVooRsRoOiPwxWaoPHVURDMDCK 3enET0mqTIQt035GYgglUMMtmE1XAQcUPZmueUYy5nzF6wSNvf5cvlefcQP/K7zCI39WkUB2c gaqsTRtiPsdl9o6x+gsuOg6yH/cwm1zallloccLdOvI4TQEbDXbqH8RzDMcYLpH1madGCgI1Y k9d3xe8hI0ClCh5pe1nzSaHQ8Plu5qBaefWEllK9iokqWHON8XYCDTEYIhmwSsrLQtCF7hU4s m14QHHNuvPmOPSSRfPX38o0nZl9eLz60DHRGdCxZ0WduE01I95FGS8/9nh+zNqh3fUNI06IG/ FHiwIrcMpuNRnVEvn+N0f/PTt1PBn5gHG8//h+zCHmS3iYXxanQJJl9qc2HkWdHAVrOoeHy3x sZBVroArDs2fFS4zErMfvWD/0tdeNiwIkYHClebYiX5O0klVA+HkpC0V7wIthnvBBpJE4kWR+ QMWWz1rjUESsB46z17Lp+zz1uj52FJeOcrQ238XtxjuNTxKrqQ6jqb8YYxtKN7jahoRRGli1c jpOSr4bFu52HSAenBeZFOF6uLbKJjJxY2W+LMMNWSUFsApT2/v7p7QsaOcuZP59+moGQ9//J/ qpZPQvUF2R9dwL2oQSh3uNVLSAT26YdjQ8q1+wm4wFV4qwp7GD0XXQeytLQyaz3DQrUlmAozE lsATv9m7zaGYy61uweMy4Fs5TvYxKmwgmxJqjacjTUWi2v6oLT5EmQGRyfVaDHdn2Q2xT/COU OlP0JqzA1JhKn7ytJSoBiIggaRKnp38kwDSVsfPomqqY5BLKXiHkAyQmMpxgf6Kt5UPfRcQpF 4UO+GFuirOMKV7rJNOi1pLjjlwjcu10GCIY8oy+BgvdCCgmcdi+hKkhnKWtpwXddPxIsC8vRy ndEWq2jjaI/sxw4mzapEnWvl/YnxNqo1aChoJBthJjSkn50aQNdNlJtetsNvUt2vVOPQTXWRB loZLdxv+D6+Gj4Y1dfLi+ambGc3Hnf4w1OCjxu/qBntQcW9N4zAWbrE7V/OQClL6hl5D/aI2X GNumg7DxLMcYMRGxJm2gmNdKxEF6q/HHPo/sRBtbQs0+BEgwlsdHvUuv8tX4oE4vyZyLhWnSG 7vsTo6wtIMmwqByBx8nTgzFnc6rBtyPrRb9r7wnn2ISMHkAotfDWuhZdGIuBOs2e/ub8Dvk+0 rUTO40itROdvxDsXC5lqi1CLclmI0yveADHpO/34YSjeN8r7WTaCfR7WSIiwNtHsQ+BpKALj4 exXhrV1mMJCwFp+ZkxnewHMlljW7NyPKfj31YajNxOoiJ1+OTP8ccf9J9/Jxaf6gUxPriIRKz K5jKe34R5cYDkT+YPqL5HkHxt7CvjvtXnHkeyZG1s7Z0pKYR7uC5T83cB+F4fhbjtDTL3vXM2 Os+F8UZpLuGkL+TxFcUk5ofGljR0vCKYmn3kYDd9xtiyqnCAHKCjx9Q1Ol8Wb0BjM+o4/Jkvn euvC5L5K1lsFYniBQf8DlmA8lPV58WQLOl2YHkWIdCqealoIBe4lYmn2whXmLa36ohAYZP/zW IkNEAo1libbJ0NXJyD89o1j98CUwTA4AtAnv/Jkr3/QIDrhJI49G9Fq3oWUXzH8CwPYRjaOWN vVh9AuWtZFibsdentqmWVbm1/3P0jqVIBrwuDU538l+tYJN6LZupRZEF+JEBFMh1tHHIRu6T1 Vn5yPjjLe3tCatKS50+WSwc0S9ChkDNGtKIsWJgY1ZR+nloglVyxNfD2zS+P/VJxOYXBqcUns vOC+8pJbGj6osxc3p8MCY40Cqzs+F38RdAMKvIQGv9+EH87+FLuhp8TP5hdzK+soR/I6OLJrU nRypPRKY+29YdgCIIfKSWJ8QMyyG1zXfAr+fb8vbUAvEPuWwrXNv8FvAg/rbSopQ0A3TiRw3a qx2vbKSUyVVnYyfTPwKjVzEjOuR/9RirxhLhFIbne+GXp+nWLM7wvfxZjea63A4buIypB9Ezf d7k9c9VgamodbG6zIFdhIaWfOQ5r/KacOqqPmWmFiPy37Lo+D1rXUsYYfa6PMj5u4kNVD4FGi +womJpGbxSw//XeyTqzJ3uGxNmlZYPaVFy67Ev3MIOxTiuLwuys5i/TwxRiWwCqVn2Zvs+QZ4 3IwuBxqLbDUm0ZD2uMya313OQksiA902XCkThDp5khDyd/TTFvFhTKUepVeoBrVih34oGlYNz 0Euzy3wyty/Qh2fwGeo1vw3fogZKpZWf92Atbdbm7Xhi4XgUi2Py90l1TA8N/Bb7jWp9Aia96 Yo9TRGMmuZCeJMm2juBBPiqYP3pQoOp13gBLxs+wsYlWMB7AbeuD3V7K9XzTINsWqIHqQweUC +h9micGELgAyvKy9du6jkT0cC6bV8MywWKTIikSfNZ1LnTzQ/tTtO3JuN0Z2jpmVazvmweYyS KYczRbdnM4vhKryoVGrg3ZCHyDiOoHQxZem7WCL72Dg18IPGyZ9JcobCZ2MxjpELJwovlr93p 0SA9xs5jQil08ERPcrv/rLQaBIbikWDdNgrUy2QH+J62w5mreG8P+rbnQZdTGfk4OAZy8CPUT GBsCywAez8Rt0IaC7k17fIV6IlQeKfqpnjIGPri4uoeBqL/gSgDY1TJqqcvOVVq1BEM6HDze+ 49StmQJRlO1KzqJpSA8Yez8S0TxJ/sPPJg9OwDjOjt0r7OufXoxJWcF1NLbD1M5Q/oJkdhXVf fEvFZZFZZhefVeN1aEGv8A1qZU+T2R/aT0BwCXRRUfYjjxN0pYAVo5+RzVXlMILI6GHNsdLno dpX11NWrsSCh33WBwSiq94BFeHwxWzDLACs7EWxpXNLJVtbFc92UlZIpJ+/TpbCP9N3et10EG iNau7Wy7tY2LZE+2g= X-DKIM: signer='web.de' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-DKIM: signer='markus.elfring@web.de' status='pass' reason='' X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [markus.elfring[at]web.de] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 =E2=80=A6 > The list of commits applied: > [1/1] platform/x86: alienware-wmi-wmax: Fix null pointer derefence in sl= eep handlers dereference? > commit: 5ae9382ac3c56d044ed065d0ba6d8c42139a8f98 How do you think about to avoid a typo in the summary phrase? Regards, Markus From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id IHCVAvwh7mgbgAMAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 10:12:12 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 10:12:12 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8c0p-00000001C2z-2q9y for hi@josie.lol; Tue, 14 Oct 2025 10:12:12 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 346853A8E17 for ; Tue, 14 Oct 2025 10:06:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E5BD72E8DF6; Tue, 14 Oct 2025 10:06:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="emG2uGWw" X-Original-To: stable@vger.kernel.org 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 B05902D2497; Tue, 14 Oct 2025 10:06:56 +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=1760436416; cv=none; b=Q4miTkxG4sB02GkAYY9wmYdDObpdEN8rlbWaNDQXxYfK04jPRyMcidKwtkfthBPZ+NHf8l1WSQQDsAj9Cwco9H/pQ6yQ9QmeUKciXrIYjDKCOP8vAjO4kzVpGRFRoQX9jjtO3qJvISqsqWoz+WJcYzuQNTPH0E3CwLhtpNqiTrA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760436416; c=relaxed/simple; bh=vlKsjF/WzeVNZJtjW7yz45GlPnNggzp2rEQRTt+qMx8=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=JzIrnqRJ1LtQMOHKcTv1tR7DL5J5Du1fQpvsyuZutGKxyPqPFjIoJQxR0FqYfM17ew9DeHbz6LbOL7W658w18WMXRE8/3UQoHOZuFkTU5POKI9MvsnvpS2T2iZG7ejicn5Ud0v04Z78qrPXH2dOIv1MsaxmeOqpdAXqXnVevvLI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=emG2uGWw; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DEA7C4CEE7; Tue, 14 Oct 2025 10:06:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760436416; bh=vlKsjF/WzeVNZJtjW7yz45GlPnNggzp2rEQRTt+qMx8=; h=Date:From:Subject:To:Cc:References:In-Reply-To:From; b=emG2uGWwq7WOFnuNE32MS8Keoa4CA6KbIjZqesYktef4aX6Mo0CONPCRuEnv76kN1 f4hF6/CT6kPvF2sUyfMQZMx8eKIS1cVMEsFSgmpSVS7k4VNJnSfmrz2Dv2Dru0tkDD b+DuY49KkTw4lTpFdwkRZtxCFCulKiJWX5GnH+2v2RF5Qt3LHkq2R8FL6sJ4reS7DY fBBQodxVpdHJs7/gqDYw5fFy4w6rrEOplf2jFTSW3Jy6TJgwiSRwLLEYZnVCfTeywn NqISKPRJe2hPHOAnPGiuDyV5JUdv/itXlFVZ46Z6l/7hU8PTUTPrt2DxQ5cs0Eb0ha uClTwYNpBTtSg== Message-ID: <1a6e25c6-820e-4610-80bb-518edca18bd5@kernel.org> Date: Tue, 14 Oct 2025 12:06:52 +0200 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Hans Verkuil Subject: Re: [PATCH v2 RESEND] media: as102: fix to not free memory after the device is registered in as102_usb_probe() To: Jeongjun Park , mchehab@kernel.org, khoroshilov@ispras.ru Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, syzbot+47321e8fd5a4c84088db@syzkaller.appspotmail.com References: <20250904054629.3849431-1-aha310510@gmail.com> Content-Language: en-US, nl In-Reply-To: <20250904054629.3849431-1-aha310510@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -3.5 (---) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-3.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: syzkaller.appspot.com] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [139.178.88.99 listed in list.dnswl.org] -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -34 On 04/09/2025 07:46, Jeongjun Park wrote: > In as102_usb driver, the following race condition occurs: > ``` > CPU0 CPU1 > as102_usb_probe() > kzalloc(); // alloc as102_dev_t > .... > usb_register_dev(); > open("/path/to/dev"); // open as102 dev > .... > usb_deregister_dev(); > .... > kfree(); // free as102_dev_t > .... > close(fd); > as102_release() // UAF!! > as102_usb_release() > kfree(); // DFB!! > ``` > > When a USB character device registered with usb_register_dev() is later > unregistered (via usb_deregister_dev() or disconnect), the device node is > removed so new open() calls fail. However, file descriptors that are > already open do not go away immediately: they remain valid until the last > reference is dropped and the driver's .release() is invoked. > > In as102, as102_usb_probe() calls usb_register_dev() and then, on an > error path, does usb_deregister_dev() and frees as102_dev_t right away. > If userspace raced a successful open() before the deregistration, that > open FD will later hit as102_release() --> as102_usb_release() and access > or free as102_dev_t again, occur a race to use-after-free and > double-free vuln. > > The fix is to never kfree(as102_dev_t) directly once usb_register_dev() > has succeeded. After deregistration, defer freeing memory to .release(). > > In other words, let release() perform the last kfree when the final open > FD is closed. > > Cc: > Reported-by: syzbot+47321e8fd5a4c84088db@syzkaller.appspotmail.com > Closes: https://syzkaller.appspot.com/bug?extid=47321e8fd5a4c84088db > Fixes: cd19f7d3e39b ("[media] as102: fix leaks at failure paths in as102_usb_probe()") > Signed-off-by: Jeongjun Park > --- > v2: Fix incorrect patch description style and CC stable mailing list > - Link to v1: https://lore.kernel.org/all/20250822143539.1157329-1-aha310510@gmail.com/ > --- > drivers/media/usb/as102/as102_usb_drv.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/media/usb/as102/as102_usb_drv.c b/drivers/media/usb/as102/as102_usb_drv.c > index e0ef66a522e2..abde5666b2ee 100644 > --- a/drivers/media/usb/as102/as102_usb_drv.c > +++ b/drivers/media/usb/as102/as102_usb_drv.c > @@ -404,6 +404,7 @@ static int as102_usb_probe(struct usb_interface *intf, > as102_free_usb_stream_buffer(as102_dev); > failed_stream: > usb_deregister_dev(intf, &as102_usb_class_driver); > + return ret; Here too I wonder if the memory is actually freed. I suspect a usb_put_intf() is needed. I'm not a USB expert, though. But you should check if you didn't replace a UAF by a memory leak. Regards, Hans > failed: > usb_put_dev(as102_dev->bus_adap.usb_dev); > usb_set_intfdata(intf, NULL); > -- > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id qJ8HC78i7miXQwMAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 10:15:27 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 10:15:27 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8c3y-00000001IYc-3gyC for hi@josie.lol; Tue, 14 Oct 2025 10:15:27 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 768DF3A9E44 for ; Tue, 14 Oct 2025 10:12:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5307F2F90CE; Tue, 14 Oct 2025 10:12:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LTLg9y4E" X-Original-To: stable@vger.kernel.org Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 443282ED15F for ; Tue, 14 Oct 2025 10:12:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760436733; cv=none; b=Lqh9qsxiTQRlFTgauZh35CcEAZ/ULgNrhX4c9RNc4UvM4mI7mfbnlBudPlPpwdFKOW3dY38Ec21fjNcNVMlN6kzTbQaTDCh/Zgm2/i5bGdQ9iKoE71ufu/iE3h3h+KpOaZNAFTPpB+wgC6g4Y38J571+KpL6KM6Z13ybh55sV+8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760436733; c=relaxed/simple; bh=tDZJGyjyFwsEnGU/+BhSU4pXv/ZOaODbT4E16jUaFWU=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sD6CNtBfSv9sYtmnCz+cia0yZRNSaf5mFRohWRaynCqnU7QAcdtAWUthWNK/N9d34afNlF7kZM/IYc2NJS6yDYSqrffqnjUW1fKGfyczvR//pOuzOgzFtzl7C1NXJG7zqSm4vLpFq1tlWFEe+zNACf14DxHlpV6nVPc7GgRXeR4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LTLg9y4E; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-46e42fa08e4so43372795e9.3 for ; Tue, 14 Oct 2025 03:12:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760436729; x=1761041529; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=TmcOUYE96CwkIuciWDdS0GQ43f2j/gyLBNOKfTnV8UA=; b=LTLg9y4EVZoqTgyp1AaPC9AqwrucU1M63waRZYt3HGKu2WtfChtCRhtH4uemKEypHI HnNynq4uI3hRdXxdJDFhYvotEZ1hNkN6AsmNLmZeb8YpXAsYs3k+D+mixG88kB/BK+UB IwzV7JqTS3vmSOJc6cYrnopyF9093sj6rG7FXryweAEJ88ua1PprSEFnFLDolL5cBv0e r0Oq8Rw8kGU6yB8oLavQ6pD+zcqlkNZJyrlOlTbrwlQOkurDD8fkSyjJa/ncXLWpvVnL l1qGVN5TAV+z5RA/MUAegQUG8f20DEgs86NZrDZzjyUb0fFT6bvIS3A9hdELUWpTnjvn 1lyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760436729; x=1761041529; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TmcOUYE96CwkIuciWDdS0GQ43f2j/gyLBNOKfTnV8UA=; b=ZvtdLiTvAoZzBYF+IQ3C2y4nr+Obqp73A+NAqGiVaqwScduM788YGaW9O2r0AGa4dv k7onKRzuv7qFOvh4ymt1JXyDxg53O1P6vbv6zKRDpuApDu8Qp75Sce4eRRlR5VE4Ckgz dqn+qVqw4Ft+PINZLhSZKjdQBY26IFazh0eJ5HuNLspO+0iwhTQN35tZhzwwGKjIK5dc MtBcTG68iEyaXfmxtW7K38blRRrOC7veqywu9j/gBP21+lHQmksiFdG79tXOkEi2Em10 LdyNwYTJlkmxPTbjMR6x/bIqeiXSrNHGf/GsH+n3P6PoH4ICSTtlUv9/gd015b4wbA98 TNsQ== X-Forwarded-Encrypted: i=1; AJvYcCVCwP0EnT9Y6M/2rPyATorDyIne3eQfTYdGBqmYc58/Bi3BUA6c86mZMqB7k5EfoHIBVCiF2yE=@vger.kernel.org X-Gm-Message-State: AOJu0YyXypSlgOKtVtRDTya/JzTHO/eGWSYRAcpjM1uRw3hHO3vjSvHD dbwSo3L/xldXl1/ZxvqBODnk48pTk4IXaFbtTeLQjx9cPSSdTML2MYLW X-Gm-Gg: ASbGncvg00gKJoipfpbGMdbT1dy8IsYbNrr2DdA2NR4vRizJKWR5Osg/bglvQ0OD6qK I8GJnL/BIccwdkvJakXw0Go6k+rFgxRlDHsVsEqt6Bq0L2N1Wr9C25sqPaLf7NodA4vEjBm3mUK ltbtjOb+U1ete7+8E62OoGwDFmscgHLf5NyR3Dt8rfCndUC9Zd1AaIKzPBnhcLHmSejc/8VotFK Qmc/XmkcNYKZl/Ysv0ZpO6zkjfTA7aPtb6vBT3K3Iy4J9WCzx0FY6j/vZbo8ZWpbpOOmvAioMVJ X8Lk0hANfcylia47IZbKlCz17taaLegL7LZHdOD1j3XgKnTlPDbkzMmml26XaX2dWLpRrys3l8s tywiQIv35E5ndmDUIXJULr0Jpm/i1QVQustWiiniYYNkqWLt30RFbLdygY0vheYw4csMG63jcBy q/pxK7ZPE= X-Google-Smtp-Source: AGHT+IF6ne/xuQ/Yzz4Zzb7wpstPRXQSA86ePFiRmshMRn4gI9s18XitfechdzacRqFT+6sY8lXeJg== X-Received: by 2002:a05:600c:3b1f:b0:46e:4340:adf7 with SMTP id 5b1f17b1804b1-46fa9a8b3c0mr176129525e9.8.1760436729180; Tue, 14 Oct 2025 03:12:09 -0700 (PDT) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-46fb4982b30sm230224825e9.6.2025.10.14.03.12.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Oct 2025 03:12:08 -0700 (PDT) Date: Tue, 14 Oct 2025 11:11:25 +0100 From: David Laight To: Geert Uytterhoeven Cc: Andrew Morton , Lance Yang , Eero Tamminen , Kent Overstreet , amaindex@outlook.com, anna.schumaker@oracle.com, boqun.feng@gmail.com, ioworker0@gmail.com, joel.granados@kernel.org, jstultz@google.com, leonylgao@tencent.com, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, longman@redhat.com, mhiramat@kernel.org, mingo@redhat.com, mingzhe.yang@ly.com, peterz@infradead.org, rostedt@goodmis.org, Finn Thain , senozhatsky@chromium.org, tfiga@chromium.org, will@kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2 1/1] hung_task: fix warnings caused by unaligned lock pointers Message-ID: <20251014111125.731ab016@pumpkin> In-Reply-To: References: <20250909145243.17119-1-lance.yang@linux.dev> <99410857-0e72-23e4-c60f-dea96427b85a@linux-m68k.org> <20251007135600.6fc4a031c60b1384dffaead1@linux-foundation.org> <56784853-b653-4587-b850-b03359306366@linux.dev> <693a62e0-a2b5-113b-d5d9-ffb7f2521d6c@linux-m68k.org> <23b67f9d-20ff-4302-810c-bf2d77c52c63@linux.dev> <2bd2c4a8-456e-426a-aece-6d21afe80643@linux.dev> <3fa8182f-0195-43ee-b163-f908a9e2cba3@linux.dev> <3e0b7551-698f-4ef6-919b-ff4cbe3aa11c@linux.dev> <20251008210453.71ba81a635fc99ce9262be7e@linux-foundation.org> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [david.laight.linux[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: -18 On Thu, 9 Oct 2025 09:11:06 +0200 Geert Uytterhoeven wrote: > Hi Andrew, > > On Thu, 9 Oct 2025 at 06:04, Andrew Morton wrote: > > On Thu, 9 Oct 2025 10:01:18 +0800 Lance Yang wrote: > > > I think we fundamentally disagree on whether this fix for known > > > false-positive warnings is needed for -stable. > > > > Having the kernel send scary warnings to our users is really bad > > behavior. And if we don't fix it, people will keep reporting it. > > As the issue is present in v6.16 and v6.17, I think that warrants -stable. > > > And removing a WARN_ON is a perfectly good way of fixing it. The > > kernel has 19,000 WARNs, probably seven of which are useful :( > > Right. And there is panic_on_warn... Which, like panic_on_oops, panics before syslogd has a chance to write the error message to /var/log/kernel. Both are set in some environments. Tracking down those crashes is a right PITA. David > > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like that. > -- Linus Torvalds > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id CIP4OrJh52jvKiMAYBR5ng (envelope-from ) for ; Thu, 09 Oct 2025 07:18:10 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Thu, 09 Oct 2025 07:18:10 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v6kug-0000000A0MA-1sbe for hi@josie.lol; Thu, 09 Oct 2025 07:18:10 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id EABFD4F2A3D for ; Thu, 9 Oct 2025 07:18:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E36212D0C75; Thu, 9 Oct 2025 07:18:02 +0000 (UTC) X-Original-To: stable@vger.kernel.org Received: from mail-qv1-f53.google.com (mail-qv1-f53.google.com [209.85.219.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2BAF724E01D for ; Thu, 9 Oct 2025 07:18:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759994282; cv=none; b=rOpACRC4QuHDg6iUnW/jFas4H6N2zHUSr871vW3Zg/i2UxVccXIwF+Bdnf050d37ETD3gk9rcXwIMCVQp/I2MK13QK9s8WtGH/+GvJ3o6+mibDmqZj7yZ74/c7aR2hgYYHZLnm+HPOBRzJqbZQXQ/NEqApOMIuVIwlgDh7DKOdY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759994282; c=relaxed/simple; bh=vHsLC2ZZf3R3Cazh2jOIeRCeKj5FEq8IfCJ5bB8jxzg=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=dTO1OLCdkM7xWiJ9Req1KIaZ4KHqS5oAs6nDQE3Qvr/1oGe3CoaX1KmVoogXi9WOzgqrJNMCINKxtZx40XQa8SwB0ohvMvHXdr2rKaWhCQJtAF/K6GZorOFrfjk4lUB/5fgAEUMVd5KO0BISDhm22MkyAk8rR2zcEzDLm0nAxls= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.219.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qv1-f53.google.com with SMTP id 6a1803df08f44-7ea50f94045so16208786d6.1 for ; Thu, 09 Oct 2025 00:18:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759994280; x=1760599080; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sLfLe9mIdxe47Pj3LvR4pabCTnZl5QqVr+O+If4CSm8=; b=ZkXy2aVjWyTjpTlurpbpzlLv8x1i6PxlfN9Ox+vdnkwCDkn9ii4jW9GrSWFMtM/Fd1 qKt8XHY+3fH+mIaPl4HWgqsMBXdI8qV6/Et2hoxRoSISqNO87X/Wp1rL76+PTViUpUwb SUqB1LihdhiSt3GQnEkw+9inUtPZiOrwpDByoxYHfPzISaMy/bVAZDcgNpl7tBI3B7ZU m6yl1/09JcR/J9tNC3NcE72oeiy/JRNwaRxQB9+oEGnP0RX9L7d2kMbvaAI2Dam7RfrJ jbKkJH8EJ/zF89NJHyFDaVaQ8Oqr5/O2UNVXocM0qDLy6+qYqlOjLDtqgUeqMBYXUIFN 9pcA== X-Forwarded-Encrypted: i=1; AJvYcCVIJaAyyvp2kCXU3CwqVgYYAc1EWu9DAF6Xz+Vo3+dIOdT/2rIoOp5QFeuJG+Y6ETrAhYDObN4=@vger.kernel.org X-Gm-Message-State: AOJu0Yx02cg2rdLt0RVJQapOj7/Xp1F3yC4G+wRksUEXlP/y1mqaghet Bp8jhHQj0SKDW4G3OT8zEP4L97MqVn78WdhahwJUDbbTtAfjlhje2g9Ts8ULIr49 X-Gm-Gg: ASbGncszvzHg5L5uVh/XWlSfHhpE3kynczHGCz1JGutjqxPk7L/mGZUR9SP43VKXj+8 cxqiStGz1kMeaPAFlK9UoxnFe1Sto9d2OcQFEO+6vPx4j2g+58zS3lQb7Tq1mmBZ5Vsf1TEaZYA sidl+Uj65utCGJUlbEUlRRNCqPg+EbauXUX7xX/8s1fBiP5j/eddDLA+aNVyjnsEQaWaf0DDhvf fAaY0WNZGXcKap4UnMZdK1SxtnCiOADqBdEXP1MuLJ6QZBPBdnzpsL5Q7dBwi6EH36sO8tVkRw8 kTVItJYPx6IVdzstjsvpp2xVqS9lLt0zwLAnT4ZW0DIl7v1/zb5RQDqvgNcTXTuYW/3hXKQsVn0 GEuIPNRNfnZqXvHCNNWSYAOszQLMbelVttzizItu/B8krskuwMepHaCpaMUfhOTTftQSHfajKRy 9ruC+nwOftybEemrg8PJ8mWjM= X-Google-Smtp-Source: AGHT+IEUSP1ncou/c8h+j+X1Lb8tMsf8prnbgrD3RYJ0pVXYEbKjH2dVcuLXjmPpf0CfVX/O7U5iTQ== X-Received: by 2002:ad4:4ea5:0:b0:813:b162:e3e6 with SMTP id 6a1803df08f44-87b3a7a22aemr100328896d6.11.1759994279833; Thu, 09 Oct 2025 00:17:59 -0700 (PDT) Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com. [209.85.222.171]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-878be61fc21sm176775626d6.63.2025.10.09.00.17.59 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Oct 2025 00:17:59 -0700 (PDT) Received: by mail-qk1-f171.google.com with SMTP id af79cd13be357-8572d7b2457so83736085a.1 for ; Thu, 09 Oct 2025 00:17:59 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCWoPFIEeIE0eqiXIxq9oClZnS4BNh+3YJ+gCSYCAkNFDZqg+F/ObiyLKOzeunreSypGQWcmyb4=@vger.kernel.org X-Received: by 2002:a05:6122:a0e:b0:552:361e:25fd with SMTP id 71dfb90a1353d-554b9193d05mr2881875e0c.2.1759993878614; Thu, 09 Oct 2025 00:11:18 -0700 (PDT) Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20250909145243.17119-1-lance.yang@linux.dev> <99410857-0e72-23e4-c60f-dea96427b85a@linux-m68k.org> <20251007135600.6fc4a031c60b1384dffaead1@linux-foundation.org> <56784853-b653-4587-b850-b03359306366@linux.dev> <693a62e0-a2b5-113b-d5d9-ffb7f2521d6c@linux-m68k.org> <23b67f9d-20ff-4302-810c-bf2d77c52c63@linux.dev> <2bd2c4a8-456e-426a-aece-6d21afe80643@linux.dev> <3fa8182f-0195-43ee-b163-f908a9e2cba3@linux.dev> <3e0b7551-698f-4ef6-919b-ff4cbe3aa11c@linux.dev> <20251008210453.71ba81a635fc99ce9262be7e@linux-foundation.org> In-Reply-To: <20251008210453.71ba81a635fc99ce9262be7e@linux-foundation.org> From: Geert Uytterhoeven Date: Thu, 9 Oct 2025 09:11:06 +0200 X-Gmail-Original-Message-ID: X-Gm-Features: AS18NWCQgTe_ntCJBOH_V5jiAjzJoJEeK5wkQ-O8aRmmail08XldJV7y3wHkl-Q Message-ID: Subject: Re: [PATCH v2 1/1] hung_task: fix warnings caused by unaligned lock pointers To: Andrew Morton Cc: Lance Yang , Eero Tamminen , Kent Overstreet , amaindex@outlook.com, anna.schumaker@oracle.com, boqun.feng@gmail.com, ioworker0@gmail.com, joel.granados@kernel.org, jstultz@google.com, leonylgao@tencent.com, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, longman@redhat.com, mhiramat@kernel.org, mingo@redhat.com, mingzhe.yang@ly.com, peterz@infradead.org, rostedt@goodmis.org, Finn Thain , senozhatsky@chromium.org, tfiga@chromium.org, will@kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.5 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in bl.score.senderscore.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 5 Hi Andrew, On Thu, 9 Oct 2025 at 06:04, Andrew Morton wrote: > On Thu, 9 Oct 2025 10:01:18 +0800 Lance Yang wrote: > > I think we fundamentally disagree on whether this fix for known > > false-positive warnings is needed for -stable. > > Having the kernel send scary warnings to our users is really bad > behavior. And if we don't fix it, people will keep reporting it. As the issue is present in v6.16 and v6.17, I think that warrants -stable. > And removing a WARN_ON is a perfectly good way of fixing it. The > kernel has 19,000 WARNs, probably seven of which are useful :( Right. And there is panic_on_warn... Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id sJssI3A052iIkwkAYBR5ng (envelope-from ) for ; Thu, 09 Oct 2025 04:05:04 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Thu, 09 Oct 2025 04:05:04 +0000 Received: from ams.mirrors.kernel.org ([213.196.21.55]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v6htn-00000003oh3-3BWY for hi@josie.lol; Thu, 09 Oct 2025 04:05:04 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.mirrors.kernel.org (Postfix) with ESMTPS id 273E134B08A for ; Thu, 9 Oct 2025 04:05:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 731661F30BB; Thu, 9 Oct 2025 04:04:55 +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="nIUztAZJ" X-Original-To: stable@vger.kernel.org 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 400F716DEB1; Thu, 9 Oct 2025 04:04:54 +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=1759982695; cv=none; b=IXfYhgfxTvxkDk7OvfldplWoXhEnQ14RpnncMXvfScWat7zTgy17KLCMjq6JjB4EZTHVTkNlngB39Gz9ArxdI8KkBxZAL0Sm2Siwq6lhxZ26m7VMaXjn7mlNtrKOk+xihn9gYCrlvdYi+q9xHy01SF6wz3NZOlXfQohqPuGnkuk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759982695; c=relaxed/simple; bh=DCmW1Fy9ep6190H7tU2v5kS2XIm6raDoEW/DHR1Vjjg=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=KdE1WJBk36n/yT4PvjBh5dESXRzhg/mUxf0BMtahDSBJrVVAYyXXtHuJhULdseufK3BgIj/6L7hxsHMi9SKvyvnDEGIbtQwyoOuK+NiZSAv3y4WG3btaT+PCa6f+M4xUk1cNcSuvbmB4Vz3SVtS42yiaRo6yk4epKrMt3psuJts= 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=nIUztAZJ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E35D1C4CEE7; Thu, 9 Oct 2025 04:04:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1759982694; bh=DCmW1Fy9ep6190H7tU2v5kS2XIm6raDoEW/DHR1Vjjg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=nIUztAZJruIzIDci75GQZX+SEixhge4TpK1eNqOb/hlvMQJFOaZTX2zEx1gcgBklJ oEzDbhGwzqUsxOaZE6o64JYS4LapPFhGlquXTm5JJNaZB3G3vqHEBvJGh9agHawsud f46csRYJjvknKBzXG25HGsS1kJoMjo7iE+A8M1l0= Date: Wed, 8 Oct 2025 21:04:53 -0700 From: Andrew Morton To: Lance Yang Cc: Geert Uytterhoeven , Eero Tamminen , Kent Overstreet , amaindex@outlook.com, anna.schumaker@oracle.com, boqun.feng@gmail.com, ioworker0@gmail.com, joel.granados@kernel.org, jstultz@google.com, leonylgao@tencent.com, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, longman@redhat.com, mhiramat@kernel.org, mingo@redhat.com, mingzhe.yang@ly.com, peterz@infradead.org, rostedt@goodmis.org, Finn Thain , senozhatsky@chromium.org, tfiga@chromium.org, will@kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2 1/1] hung_task: fix warnings caused by unaligned lock pointers Message-Id: <20251008210453.71ba81a635fc99ce9262be7e@linux-foundation.org> In-Reply-To: <3e0b7551-698f-4ef6-919b-ff4cbe3aa11c@linux.dev> References: <20250909145243.17119-1-lance.yang@linux.dev> <99410857-0e72-23e4-c60f-dea96427b85a@linux-m68k.org> <20251007135600.6fc4a031c60b1384dffaead1@linux-foundation.org> <56784853-b653-4587-b850-b03359306366@linux.dev> <693a62e0-a2b5-113b-d5d9-ffb7f2521d6c@linux-m68k.org> <23b67f9d-20ff-4302-810c-bf2d77c52c63@linux.dev> <2bd2c4a8-456e-426a-aece-6d21afe80643@linux.dev> <3fa8182f-0195-43ee-b163-f908a9e2cba3@linux.dev> <3e0b7551-698f-4ef6-919b-ff4cbe3aa11c@linux.dev> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-DKIM: signer='linux-foundation.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -0.3 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-0.3 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linux-foundation.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [213.196.21.55 listed in bl.score.senderscore.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [213.196.21.55 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [213.196.21.55 listed in sa-accredit.habeas.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.7 NICE_REPLY_A Looks like a legit reply (A) -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: -2 On Thu, 9 Oct 2025 10:01:18 +0800 Lance Yang wrote: > I think we fundamentally disagree on whether this fix for known > false-positive warnings is needed for -stable. Having the kernel send scary warnings to our users is really bad behavior. And if we don't fix it, people will keep reporting it. And removing a WARN_ON is a perfectly good way of fixing it. The kernel has 19,000 WARNs, probably seven of which are useful :( From: Lance Yang Subject: hung_task: fix warnings caused by unaligned lock pointers Date: Tue, 9 Sep 2025 22:52:43 +0800 From: Lance Yang The blocker tracking mechanism assumes that lock pointers are at least 4-byte aligned to use their lower bits for type encoding. However, as reported by Eero Tamminen, some architectures like m68k only guarantee 2-byte alignment of 32-bit values. This breaks the assumption and causes two related WARN_ON_ONCE checks to trigger. To fix this, the runtime checks are adjusted to silently ignore any lock that is not 4-byte aligned, effectively disabling the feature in such cases and avoiding the related warnings. Thanks to Geert Uytterhoeven for bisecting! Link: https://lkml.kernel.org/r/20250909145243.17119-1-lance.yang@linux.dev Fixes: e711faaafbe5 ("hung_task: replace blocker_mutex with encoded blocker") Signed-off-by: Lance Yang Reported-by: Eero Tamminen Closes: https://lore.kernel.org/lkml/CAMuHMdW7Ab13DdGs2acMQcix5ObJK0O2dG_Fxzr8_g58Rc1_0g@mail.gmail.com Reviewed-by: Masami Hiramatsu (Google) Cc: John Paul Adrian Glaubitz Cc: Anna Schumaker Cc: Boqun Feng Cc: Finn Thain Cc: Geert Uytterhoeven Cc: Ingo Molnar Cc: Joel Granados Cc: John Stultz Cc: Kent Overstreet Cc: Lance Yang Cc: Mingzhe Yang Cc: Peter Zijlstra Cc: Sergey Senozhatsky Cc: Steven Rostedt Cc: Tomasz Figa Cc: Waiman Long Cc: Will Deacon Cc: Yongliang Gao Cc: Signed-off-by: Andrew Morton --- include/linux/hung_task.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/include/linux/hung_task.h~hung_task-fix-warnings-caused-by-unaligned-lock-pointers +++ a/include/linux/hung_task.h @@ -20,6 +20,10 @@ * always zero. So we can use these bits to encode the specific blocking * type. * + * Note that on architectures where this is not guaranteed, or for any + * unaligned lock, this tracking mechanism is silently skipped for that + * lock. + * * Type encoding: * 00 - Blocked on mutex (BLOCKER_TYPE_MUTEX) * 01 - Blocked on semaphore (BLOCKER_TYPE_SEM) @@ -45,7 +49,7 @@ static inline void hung_task_set_blocker * If the lock pointer matches the BLOCKER_TYPE_MASK, return * without writing anything. */ - if (WARN_ON_ONCE(lock_ptr & BLOCKER_TYPE_MASK)) + if (lock_ptr & BLOCKER_TYPE_MASK) return; WRITE_ONCE(current->blocker, lock_ptr | type); @@ -53,8 +57,6 @@ static inline void hung_task_set_blocker static inline void hung_task_clear_blocker(void) { - WARN_ON_ONCE(!READ_ONCE(current->blocker)); - WRITE_ONCE(current->blocker, 0UL); } _ From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id 6KcAM8sX52ip1z0AYBR5ng (envelope-from ) for ; Thu, 09 Oct 2025 02:02:51 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Thu, 09 Oct 2025 02:02:51 +0000 Received: from ams.mirrors.kernel.org ([213.196.21.55]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v6fzX-0000000HVnd-1SxF for hi@josie.lol; Thu, 09 Oct 2025 02:02:51 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.mirrors.kernel.org (Postfix) with ESMTPS id 027F034AFD4 for ; Thu, 9 Oct 2025 02:02:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 042351891AB; Thu, 9 Oct 2025 02:02:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="ibQ2QABF" X-Original-To: stable@vger.kernel.org Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (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 D19231B4F1F for ; Thu, 9 Oct 2025 02:02:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.183 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759975335; cv=none; b=Vc4t4tewMJeK3tzeV+pzh7coUplS0m5Kea7EIj4Oc/vLTSmfnizosBUDmg1RxkS819cyuE1nOhu2q58TsSKnxNQ2/h4NZkHaLUaazrnimo5tCxfiQGofYSIkHa/e5nPU3yZ1zhaNcQurlTHJdQCSv9ieqB9sr632BQSxu+c5NeM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759975335; c=relaxed/simple; bh=FGWwqKnQ6kJ8i65qahfQZ38o0N58kC2zqWCBjd710Ao=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=qy69INubNKnh6paqUCt6Mglpn1A/5cq10Dvn5OtFZnH5MOG3LebRTea0HwkH6Y72aNRv8NW+h5yN3eNVvKj249igs5PFQb5SSNblNmaKJC+LNcSbp1oZjgYZMiiZdLU3BySKUmUcjPZPzorjCnlPE4pnIwow190iDx5IF8bVJ6k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=ibQ2QABF; arc=none smtp.client-ip=91.218.175.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: <3e0b7551-698f-4ef6-919b-ff4cbe3aa11c@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1759975319; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZhDQlPsddEKheWIQpFcriCM6m7o0PSu3nTL17MTHX4o=; b=ibQ2QABFSTUpvgdiYujW8QvoiiTr1qEW3Tdy3UeDf8h5TEfQnjsr5maVJuqWlDZTTUlXD5 yI3rzmoIa5SFI48PvMG3ZLD3PcxHf2ijRHO6zBJyHIVZ1/i0ruLKCavWH9QgnbffM0axmv synA/a4qrBBCMmUDmk+vT/aydAh+VYU= Date: Thu, 9 Oct 2025 10:01:18 +0800 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v2 1/1] hung_task: fix warnings caused by unaligned lock pointers Content-Language: en-US To: Andrew Morton Cc: Geert Uytterhoeven , Eero Tamminen , Kent Overstreet , amaindex@outlook.com, anna.schumaker@oracle.com, boqun.feng@gmail.com, ioworker0@gmail.com, joel.granados@kernel.org, jstultz@google.com, leonylgao@tencent.com, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, longman@redhat.com, mhiramat@kernel.org, mingo@redhat.com, mingzhe.yang@ly.com, peterz@infradead.org, rostedt@goodmis.org, Finn Thain , senozhatsky@chromium.org, tfiga@chromium.org, will@kernel.org, stable@vger.kernel.org References: <20250909145243.17119-1-lance.yang@linux.dev> <99410857-0e72-23e4-c60f-dea96427b85a@linux-m68k.org> <20251007135600.6fc4a031c60b1384dffaead1@linux-foundation.org> <56784853-b653-4587-b850-b03359306366@linux.dev> <693a62e0-a2b5-113b-d5d9-ffb7f2521d6c@linux-m68k.org> <23b67f9d-20ff-4302-810c-bf2d77c52c63@linux.dev> <2bd2c4a8-456e-426a-aece-6d21afe80643@linux.dev> <3fa8182f-0195-43ee-b163-f908a9e2cba3@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Lance Yang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-DKIM: signer='linux.dev' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [213.196.21.55 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [213.196.21.55 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [213.196.21.55 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linux.dev] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 @Andrew, what's your call on this? I think we fundamentally disagree on whether this fix for known false-positive warnings is needed for -stable. Rather than continuing this thread, let's just ask the maintainer. Thanks, Lance On 2025/10/9 05:55, Finn Thain wrote: > > On Wed, 8 Oct 2025, Lance Yang wrote: > >> On 2025/10/8 18:12, Finn Thain wrote: >>> >>> On Wed, 8 Oct 2025, Lance Yang wrote: >>> >>>> >>>> In other words, we are not just fixing the bug reported by Eero and >>>> Geert, but correcting the blocker tracking mechanism's flawed >>>> assumption for -stable ;) >>>> >>>> If you feel this doesn't qualify as a fix, I can change the Fixes: >>>> tag to point to the original commit that introduced this flawed >>>> mechanism instead. >>>> >>> >>> That's really a question for the bug reporters. I don't personally >>> have a problem with CONFIG_DETECT_HUNG_TASK_BLOCKER so I can't say >>> whether the fix meets the requirements set in >>> Documentation/process/stable-kernel-rules.rst. And I still don't know >> >> I'm a bit confused, as I recall you previously stating that "It's wrong >> and should be fixed"[1]. >> > > You took that quote out of context. Please go and read it again. > >> To clarify, is your current position that it should be fixed in general, >> but the fix should not be backported to -stable? >> > > To clarify, what do you mean by "it"? Is it the commentary discussed in > [1]? The misalignment of atomics? The misalignment of locks? The alignment > assumptions in your code? The WARN reported by Eero and Geert? > >> If so, then I have nothing further to add to this thread and am happy to >> let the maintainer @Andrew decide. >> >>> what's meant by "unnecessary warnings in a few unexpected cases". >> >> The blocker tracking mechanism will trigger a warning when it encounters >> any unaligned lock pointer (e.g., from a packed struct). I don't think >> that is the expected behavior. > > Sure, no-one was expecting false positives. > > I think you are conflating "misaligned" with "not 4-byte aligned". Your > algorithm does not strictly require natural alignment, it requires 4-byte > alignment of locks. > > Regarding your concern about packed structs, please re-read this message: > https://lore.kernel.org/all/CAMuHMdV-AtPm-W-QUC1HixJ8Koy_HdESwCCOhRs3Q26=wjWwog@mail.gmail.com/ > > AFAIK the problem with your code is nothing more than the usual difficulty > encountered when porting between architectures that have different > alignment rules for scalar variables. > > Therefore, my question about the theoretical nature of the problem comes > down to this. > > Is the m68k architecture the only one producing actual false positives? > > Do you know of actual instances of locks in packed structs? > >> Instead, it should simply skip any unaligned pointer it cannot handle. >> For the stable kernels, at least, this is the correct behavior. >> > > Why? Are users of the stable branch actually affected? > >> [1] >> https://lore.kernel.org/lkml/6ec95c3f-365b-e352-301b-94ab3d8af73c@linux-m68k.org/ >> >> From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id qBDBK+bd5mi7GR4AYBR5ng (envelope-from ) for ; Wed, 08 Oct 2025 21:55:50 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Wed, 08 Oct 2025 21:55:50 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v6c8U-00000009YLD-0n32 for hi@josie.lol; Wed, 08 Oct 2025 21:55:50 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6676F19E0327 for ; Wed, 8 Oct 2025 21:56:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 39AB529B239; Wed, 8 Oct 2025 21:55:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="dUr0AYZK" X-Original-To: stable@vger.kernel.org Received: from fhigh-b5-smtp.messagingengine.com (fhigh-b5-smtp.messagingengine.com [202.12.124.156]) (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 1D22E266584; Wed, 8 Oct 2025 21:55:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.156 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759960544; cv=none; b=NnhMfm7ztlDievSu7ey7v6JYU+VPCqbae0C6p229ebnjHzBDPoP0NxnyRKjEY2DFDbms/opJO9Dr9pxQJr/iRELhY7NcEsbeRvqtl3BCrF0jFwPK3FwWJCdr1IfBD0SMGRLx16PuyZy+5iay+7ih3fyoX1wMaQEHojs4wI5rhNI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759960544; c=relaxed/simple; bh=W8sZ+BFTCFqdywOhx6jN5UpBCcjv8tYtA+nU9zRVybk=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=ar9HdbKN0XeDD8aSoP6kJ5yllTHZ2har2CseybRe813fPkRpqFWIoSS4QjCXIwgMIQ5/EjHiOpODyGPlIbttp2LGoGt+p/N3mHUlLJloT91HTJHbPiThlJknyo+JGwv67p/O2ymID5N6cC2QfqQGLbS7c4Fd5Lm3CZEle84o8Oc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=none smtp.mailfrom=linux-m68k.org; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=dUr0AYZK; arc=none smtp.client-ip=202.12.124.156 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from phl-compute-10.internal (phl-compute-10.internal [10.202.2.50]) by mailfhigh.stl.internal (Postfix) with ESMTP id 9ABE77A0038; Wed, 8 Oct 2025 17:55:40 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-10.internal (MEProxy); Wed, 08 Oct 2025 17:55:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1759960540; x=1760046940; bh=fR1Nie9bPqSH+8AGTkokUlJXi6wRqyLLqLK 19/Nvduo=; b=dUr0AYZKwOAHn5J/U/fC0j855M02UZTZeZe3m1DETCeso4o4uw9 X7d8h877mcox+pcfQI0tCk/ifSduIaU8VPTP/EJLC/NeAhwOjwBt02tuCqPKGjO0 qxhDetcxjkKsyxiQKZVXNZb7583tmyIv9ZV0aZRH9Wc/CJtuWpm8uRHFvGdoXRFx WzlxmclTXm63fdljUwFP9SuDig9mItaiHR4pOCIs9yv6MTgol86OBbjX/7FVyymd uoRXpKrcI6hQ6OAvAjEAfat3/q2BfH4lrH8MTC8A6MigRvLqwxCLGAk1NHGMni92 MBn3W8HhdBm/YekHwrLi56G5SQmsfiXKOpQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddutdeggeegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevufgjkfhfgggtsehttdertddttddvnecuhfhrohhmpefhihhnnhcuvfhh rghinhcuoehfthhhrghinheslhhinhhugidqmheikehkrdhorhhgqeenucggtffrrghtth gvrhhnpeefieehjedvtefgiedtudethfekieelhfevhefgvddtkeekvdekhefftdekvedv ueenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepfhhthhgrihhnsehlihhnuhigqdhmieekkhdr ohhrghdpnhgspghrtghpthhtohepvdegpdhmohguvgepshhmthhpohhuthdprhgtphhtth hopehlrghntggvrdihrghngheslhhinhhugidruggvvhdprhgtphhtthhopegrkhhpmhes lhhinhhugidqfhhouhhnuggrthhiohhnrdhorhhgpdhrtghpthhtohepghgvvghrtheslh hinhhugidqmheikehkrdhorhhgpdhrtghpthhtohepohgrkheshhgvlhhsihhnkhhinhgv thdrfhhipdhrtghpthhtohepkhgvnhhtrdhovhgvrhhsthhrvggvtheslhhinhhugidrug gvvhdprhgtphhtthhopegrmhgrihhnuggvgiesohhuthhlohhokhdrtghomhdprhgtphht thhopegrnhhnrgdrshgthhhumhgrkhgvrhesohhrrggtlhgvrdgtohhmpdhrtghpthhtoh epsghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmpdhrtghpthhtohepihhofihorhhk vghrtdesghhmrghilhdrtghomh X-ME-Proxy: Feedback-ID: i58a146ae:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 8 Oct 2025 17:55:35 -0400 (EDT) Date: Thu, 9 Oct 2025 08:55:21 +1100 (AEDT) From: Finn Thain To: Lance Yang cc: Andrew Morton , Geert Uytterhoeven , Eero Tamminen , Kent Overstreet , amaindex@outlook.com, anna.schumaker@oracle.com, boqun.feng@gmail.com, ioworker0@gmail.com, joel.granados@kernel.org, jstultz@google.com, leonylgao@tencent.com, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, longman@redhat.com, mhiramat@kernel.org, mingo@redhat.com, mingzhe.yang@ly.com, peterz@infradead.org, rostedt@goodmis.org, senozhatsky@chromium.org, tfiga@chromium.org, will@kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2 1/1] hung_task: fix warnings caused by unaligned lock pointers In-Reply-To: <3fa8182f-0195-43ee-b163-f908a9e2cba3@linux.dev> Message-ID: References: <20250909145243.17119-1-lance.yang@linux.dev> <99410857-0e72-23e4-c60f-dea96427b85a@linux-m68k.org> <20251007135600.6fc4a031c60b1384dffaead1@linux-foundation.org> <56784853-b653-4587-b850-b03359306366@linux.dev> <693a62e0-a2b5-113b-d5d9-ffb7f2521d6c@linux-m68k.org> <23b67f9d-20ff-4302-810c-bf2d77c52c63@linux.dev> <2bd2c4a8-456e-426a-aece-6d21afe80643@linux.dev> <3fa8182f-0195-43ee-b163-f908a9e2cba3@linux.dev> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-DKIM: signer='messagingengine.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.8 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.8 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: messagingengine.com] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [147.75.80.249 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.80.249 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.80.249 listed in bl.score.senderscore.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: -17 On Wed, 8 Oct 2025, Lance Yang wrote: > On 2025/10/8 18:12, Finn Thain wrote: > > > > On Wed, 8 Oct 2025, Lance Yang wrote: > > > >> > >> In other words, we are not just fixing the bug reported by Eero and > >> Geert, but correcting the blocker tracking mechanism's flawed > >> assumption for -stable ;) > >> > >> If you feel this doesn't qualify as a fix, I can change the Fixes: > >> tag to point to the original commit that introduced this flawed > >> mechanism instead. > >> > > > > That's really a question for the bug reporters. I don't personally > > have a problem with CONFIG_DETECT_HUNG_TASK_BLOCKER so I can't say > > whether the fix meets the requirements set in > > Documentation/process/stable-kernel-rules.rst. And I still don't know > > I'm a bit confused, as I recall you previously stating that "It's wrong > and should be fixed"[1]. > You took that quote out of context. Please go and read it again. > To clarify, is your current position that it should be fixed in general, > but the fix should not be backported to -stable? > To clarify, what do you mean by "it"? Is it the commentary discussed in [1]? The misalignment of atomics? The misalignment of locks? The alignment assumptions in your code? The WARN reported by Eero and Geert? > If so, then I have nothing further to add to this thread and am happy to > let the maintainer @Andrew decide. > > > what's meant by "unnecessary warnings in a few unexpected cases". > > The blocker tracking mechanism will trigger a warning when it encounters > any unaligned lock pointer (e.g., from a packed struct). I don't think > that is the expected behavior. Sure, no-one was expecting false positives. I think you are conflating "misaligned" with "not 4-byte aligned". Your algorithm does not strictly require natural alignment, it requires 4-byte alignment of locks. Regarding your concern about packed structs, please re-read this message: https://lore.kernel.org/all/CAMuHMdV-AtPm-W-QUC1HixJ8Koy_HdESwCCOhRs3Q26=wjWwog@mail.gmail.com/ AFAIK the problem with your code is nothing more than the usual difficulty encountered when porting between architectures that have different alignment rules for scalar variables. Therefore, my question about the theoretical nature of the problem comes down to this. Is the m68k architecture the only one producing actual false positives? Do you know of actual instances of locks in packed structs? > Instead, it should simply skip any unaligned pointer it cannot handle. > For the stable kernels, at least, this is the correct behavior. > Why? Are users of the stable branch actually affected? > [1] > https://lore.kernel.org/lkml/6ec95c3f-365b-e352-301b-94ab3d8af73c@linux-m68k.org/ > > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id mEJoJtBr5mhcJx4AYBR5ng (envelope-from ) for ; Wed, 08 Oct 2025 13:49:04 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Wed, 08 Oct 2025 13:49:04 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v6UXQ-00000009xBG-1fUC for hi@josie.lol; Wed, 08 Oct 2025 13:49:04 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id B00514E71F3 for ; Wed, 8 Oct 2025 13:49:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B770C286D55; Wed, 8 Oct 2025 13:48:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="XN18ZBQH" X-Original-To: stable@vger.kernel.org Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) (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 B65D8286420 for ; Wed, 8 Oct 2025 13:48:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759931339; cv=none; b=hePCWelSkcG1KfNbg7Wq8Ern5sgCTKNuyCP76mtjwudKB3gi1y0ZRijx5YFHRRf589vqmO7ws4aO4pl5hIAWxHTslESYn+FLHOwHtx4MqG7yHYdeDjLHLu9MoJ7lVgn4HpdhbZBlpQciEQfHZMfRoVWkPyXYJuqdm8u+ouXk0gU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759931339; c=relaxed/simple; bh=GbSaa/EKZ5s8UkgtPrh/MX8WgMkQZPaiA6bJfdaGpgw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=VfyNejVdYcqvAr4oysVx1+bAUSNL8C52uAlD57GoZm67eVROKqC2JpYXqb7O+QqbO0JkckSbqx8NHOChtsCRaf4iEzEaCHgD/N6yk2+IdITL3JTpszH98GjSfVzlgbAr33QRCqt2wymzQNGsc/DxOxHc8R7CNeoCL5QK5E6PlrM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=XN18ZBQH; arc=none smtp.client-ip=91.218.175.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: <3fa8182f-0195-43ee-b163-f908a9e2cba3@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1759931325; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Uf5/duJrWVKUCDJFgAcXUExHgRsL5XyYj1G/kjKoQGw=; b=XN18ZBQHkL8VF42r5TRMQE022lIyv/4biRi92DxLzr+OwHWrQo1lBg7HW2YB6owPNKY/AP h3sdwVABCXdpNWT92wcOEWaDCwUIs7coRdTd6DNumvRABDWHVg3NmTg3WWMQ3spQWmrow/ /rU1jTQvLss0mVrtlzpXkiR37xDte28= Date: Wed, 8 Oct 2025 21:48:36 +0800 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v2 1/1] hung_task: fix warnings caused by unaligned lock pointers Content-Language: en-US To: Finn Thain , Andrew Morton Cc: Geert Uytterhoeven , Eero Tamminen , Kent Overstreet , amaindex@outlook.com, anna.schumaker@oracle.com, boqun.feng@gmail.com, ioworker0@gmail.com, joel.granados@kernel.org, jstultz@google.com, leonylgao@tencent.com, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, longman@redhat.com, mhiramat@kernel.org, mingo@redhat.com, mingzhe.yang@ly.com, peterz@infradead.org, rostedt@goodmis.org, senozhatsky@chromium.org, tfiga@chromium.org, will@kernel.org, stable@vger.kernel.org References: <20250909145243.17119-1-lance.yang@linux.dev> <99410857-0e72-23e4-c60f-dea96427b85a@linux-m68k.org> <20251007135600.6fc4a031c60b1384dffaead1@linux-foundation.org> <56784853-b653-4587-b850-b03359306366@linux.dev> <693a62e0-a2b5-113b-d5d9-ffb7f2521d6c@linux-m68k.org> <23b67f9d-20ff-4302-810c-bf2d77c52c63@linux.dev> <2bd2c4a8-456e-426a-aece-6d21afe80643@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Lance Yang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-DKIM: signer='linux.dev' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in bl.score.senderscore.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linux.dev] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in sa-trusted.bondedsender.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On 2025/10/8 18:12, Finn Thain wrote: > > On Wed, 8 Oct 2025, Lance Yang wrote: > >> >> In other words, we are not just fixing the bug reported by Eero and >> Geert, but correcting the blocker tracking mechanism's flawed assumption >> for -stable ;) >> >> If you feel this doesn't qualify as a fix, I can change the Fixes: tag >> to point to the original commit that introduced this flawed mechanism >> instead. >> > > That's really a question for the bug reporters. I don't personally have a > problem with CONFIG_DETECT_HUNG_TASK_BLOCKER so I can't say whether the > fix meets the requirements set in > Documentation/process/stable-kernel-rules.rst. And I still don't know I'm a bit confused, as I recall you previously stating that "It's wrong and should be fixed"[1]. To clarify, is your current position that it should be fixed in general, but the fix should not be backported to -stable? If so, then I have nothing further to add to this thread and am happy to let the maintainer @Andrew decide. > what's meant by "unnecessary warnings in a few unexpected cases". The blocker tracking mechanism will trigger a warning when it encounters any unaligned lock pointer (e.g., from a packed struct). I don't think that is the expected behavior. Instead, it should simply skip any unaligned pointer it cannot handle. For the stable kernels, at least, this is the correct behavior. [1] https://lore.kernel.org/lkml/6ec95c3f-365b-e352-301b-94ab3d8af73c@linux-m68k.org/ From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id IAFPMMZh5mhdJx4AYBR5ng (envelope-from ) for ; Wed, 08 Oct 2025 13:06:14 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Wed, 08 Oct 2025 13:06:14 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v6Trx-00000008OTy-1yJB for hi@josie.lol; Wed, 08 Oct 2025 13:06:14 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 7C5704EA6E5 for ; Wed, 8 Oct 2025 13:06:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4AFF7253356; Wed, 8 Oct 2025 13:06:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=helsinkinet.fi header.i=@helsinkinet.fi header.b="BQqPu1u4" X-Original-To: stable@vger.kernel.org Received: from smtp.dnamail.fi (sender001.dnamail.fi [83.102.40.178]) (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 BEE88241691; Wed, 8 Oct 2025 13:06:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=83.102.40.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759928770; cv=none; b=krIuUmXs2pgu4/e8eDSPMW9biqKUYYSDulLuR6MyWH//Y8L31CY/HbgE38iL89ld3lTSO1vaXJCxB+VtSJh4JOatVDyhCJWRIDZt3MJgItR/KoQRhxFHXJc51k+v8iMPH88n82FmiNs+7uOd8ofm9b3FXwhkAD7y/+mzoHVgBe8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759928770; c=relaxed/simple; bh=bDBSmVBWpfbY7PAaZEpHubLf7uYeTwh3B4k6cq15LUU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=TssGNtr5mp7C+kuE25O5wRlE4TOkNzl0WNbU8eme8hljHoOIES13F+is29m7vH5OPD/eUXhc0d5j3cnOBUlmhYvIV7+Bkpp9a/4fJwJlvXVXkGTFaR1E+1CiPVdUTcGo6PBx0CQfsZHY/QS8Bd1X7eA9BbMqFbWXYHTqlVhCxXw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=helsinkinet.fi; spf=pass smtp.mailfrom=helsinkinet.fi; dkim=pass (2048-bit key) header.d=helsinkinet.fi header.i=@helsinkinet.fi header.b=BQqPu1u4; arc=none smtp.client-ip=83.102.40.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=helsinkinet.fi Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=helsinkinet.fi Received: from localhost (localhost [127.0.0.1]) by smtp.dnamail.fi (Postfix) with ESMTP id 387E22113E0A; Wed, 8 Oct 2025 15:56:24 +0300 (EEST) X-Virus-Scanned: X-Virus-Scanned: amavis at smtp.dnamail.fi Received: from smtp.dnamail.fi ([83.102.40.178]) by localhost (dmail-psmtp01.s.dnaip.fi [127.0.0.1]) (amavis, port 10024) with ESMTP id GDv7ZgzeFdQs; Wed, 8 Oct 2025 15:56:23 +0300 (EEST) Received: from [192.168.101.100] (87-92-77-37.bb.dnainternet.fi [87.92.77.37]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: oak@dnamail.internal) by smtp.dnamail.fi (Postfix) with ESMTPSA id C32C62113FD1; Wed, 8 Oct 2025 15:56:20 +0300 (EEST) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.dnamail.fi C32C62113FD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=helsinkinet.fi; s=2025-03; t=1759928183; bh=OCj4WpQavSfPv91/WhnHhKdc5F/dvQGVXuCoN9OhquQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=BQqPu1u4Gnwm7jNBwS6NTOLQjgETu9AVmi5nHDxfI0dT/1ZRe83rb2GFU2WAUcnK3 oFcqed3tvdPWTDbLxqzwbcdTuCHH4jU2Zp7gzB2NiWOPnynpnWbJpUsNLsX38Fycbl OVoyJzG8lSDG6gocx12s+WcWk1QNRdMAj7ozKhWDWNj8qZB9C+Qza7V6v5VcWZQf7A /C91tytd4rio59SwMzMZzIs1RxWfUYdLd7dcrSwb4wWu27SSfy8qju6UFs278V6hfS Eo3Z3W+QirXeKTxcciVE7dDfaS0eh3h/0DAq5zzMXrQd5/8lg6QsU21X3nPovzJwUY 8HYJOl/PfdZTg== Message-ID: <8864b0ad-d9c7-4de3-b7e7-95512778822d@helsinkinet.fi> Date: Wed, 8 Oct 2025 15:56:20 +0300 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/1] hung_task: fix warnings caused by unaligned lock pointers To: Finn Thain , Andrew Morton , Geert Uytterhoeven Cc: Kent Overstreet , Lance Yang , amaindex@outlook.com, anna.schumaker@oracle.com, boqun.feng@gmail.com, ioworker0@gmail.com, joel.granados@kernel.org, jstultz@google.com, leonylgao@tencent.com, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, longman@redhat.com, mhiramat@kernel.org, mingo@redhat.com, mingzhe.yang@ly.com, peterz@infradead.org, rostedt@goodmis.org, senozhatsky@chromium.org, tfiga@chromium.org, will@kernel.org, stable@vger.kernel.org References: <20250909145243.17119-1-lance.yang@linux.dev> <99410857-0e72-23e4-c60f-dea96427b85a@linux-m68k.org> <20251007135600.6fc4a031c60b1384dffaead1@linux-foundation.org> Content-Language: en-US From: Eero Tamminen In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-DKIM: signer='helsinkinet.fi' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in sa-accredit.habeas.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 Hi, On 10/8/25 03:40, Finn Thain wrote: > On Tue, 7 Oct 2025, Andrew Morton wrote: >> Getting back to the $Subject at hand, are people OK with proceeding >> with Lance's original fix? > > Lance's patch is probably more appropriate for -stable than the patch I > proposed -- assuming a fix is needed for -stable. > > Besides those two alternatives, there is also a workaround: > $ ./scripts/config -d DETECT_HUNG_TASK_BLOCKER > which may be acceptable to the interested parties (i.e. m68k users). > > I don't have a preference. I'll leave it up to the bug reporters (Eero and > Geert). It's good for me. - Eero From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id WG41Iho55mjxcQgAYBR5ng (envelope-from ) for ; Wed, 08 Oct 2025 10:12:42 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Wed, 08 Oct 2025 10:12:42 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v6RA2-00000002Lkj-1AaI for hi@josie.lol; Wed, 08 Oct 2025 10:12:42 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 001874E7F8F for ; Wed, 8 Oct 2025 10:12:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 167472F28EE; Wed, 8 Oct 2025 10:12:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="KapiCPuC" X-Original-To: stable@vger.kernel.org Received: from fout-b6-smtp.messagingengine.com (fout-b6-smtp.messagingengine.com [202.12.124.149]) (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 10DFE2EBDF0; Wed, 8 Oct 2025 10:12:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.149 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759918358; cv=none; b=o4ANX6+PwwrCkPNehEGJb/OF7jogneJ4XN1YjChHJtPn5rkRX18acwBr224MWukwxp7yuVFerFKMM0uUxP9NhEaFipvUfCtMY29zXb8dakwjvZqltedcejxh8QgUTZ9CqXbMR09pFT55nKJrOdIPfWwsy0yoUXuZIPqb+/jU8lo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759918358; c=relaxed/simple; bh=jTzS4kwuSRRXeuWd1CLD8POBVGHVhraKrwblg4VzhoY=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=hdLLeCPQbX9y1kHk2nnwEDRxHkMrpOJwIOeZyN9iYIbPxZXgbmr8746iFAiP2C9EBlqee8nXJ+/tCfIa2TjeJDvuXSBlxsUR7xT9GgEmgxHMSyiAijtvRFmPO4x4eYQmJJ2CkA4eZxn12fZikoP7T94d3p5iUd/KLp068ZKGBhs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=none smtp.mailfrom=linux-m68k.org; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=KapiCPuC; arc=none smtp.client-ip=202.12.124.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id B05E91D000FE; Wed, 8 Oct 2025 06:12:34 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Wed, 08 Oct 2025 06:12:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1759918354; x=1760004754; bh=C0mcj3R+Pq8SIGSRvhGuf+yHogOBW1PlBpA 1eheqQNM=; b=KapiCPuCp29GApxnLpCSKulJsqpaf8XHRowgnKPp4jrgvHasYCZ Et4yb5sn+JzWcER1uSpLeM71B9du/M1aRSzq0zTWWybwyaJ2Pzl6fHGGGwcyIMBy MNa0JZIjKuZaS5oPw+1wBI/9z7lOC7wEFGsoLMUMJkxAt3glA77fZDSth0IP+PGd mwuVEu+KoQKd4a/z/HXGLeZawExXcoShz5zRASOfKV0u6nQOF6lBpvBJlGMxr3VX IiXVBU74iOgaDJktCoe4suDAR7p0uOpNufzCAxI448uFV4HYY7mbwCJtqEfEvHwV 6Hr3Ak+57cjrRbPkk+cJtr0ah4KAIkv0hWA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddutdeftddvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevufgjkfhfgggtsehttdertddttddvnecuhfhrohhmpefhihhnnhcuvfhh rghinhcuoehfthhhrghinheslhhinhhugidqmheikehkrdhorhhgqeenucggtffrrghtth gvrhhnpeelueehleehkefgueevtdevteejkefhffekfeffffdtgfejveekgeefvdeuheeu leenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehfth hhrghinheslhhinhhugidqmheikehkrdhorhhgpdhnsggprhgtphhtthhopedvgedpmhho uggvpehsmhhtphhouhhtpdhrtghpthhtoheplhgrnhgtvgdrhigrnhhgsehlihhnuhigrd guvghvpdhrtghpthhtoheprghkphhmsehlihhnuhigqdhfohhunhgurghtihhonhdrohhr ghdprhgtphhtthhopehgvggvrhhtsehlihhnuhigqdhmieekkhdrohhrghdprhgtphhtth hopehorghksehhvghlshhinhhkihhnvghtrdhfihdprhgtphhtthhopehkvghnthdrohhv vghrshhtrhgvvghtsehlihhnuhigrdguvghvpdhrtghpthhtoheprghmrghinhguvgigse houhhtlhhoohhkrdgtohhmpdhrtghpthhtoheprghnnhgrrdhstghhuhhmrghkvghrseho rhgrtghlvgdrtghomhdprhgtphhtthhopegsohhquhhnrdhfvghnghesghhmrghilhdrtg homhdprhgtphhtthhopehiohifohhrkhgvrhdtsehgmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: i58a146ae:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 8 Oct 2025 06:12:29 -0400 (EDT) Date: Wed, 8 Oct 2025 21:12:24 +1100 (AEDT) From: Finn Thain To: Lance Yang cc: Andrew Morton , Geert Uytterhoeven , Eero Tamminen , Kent Overstreet , amaindex@outlook.com, anna.schumaker@oracle.com, boqun.feng@gmail.com, ioworker0@gmail.com, joel.granados@kernel.org, jstultz@google.com, leonylgao@tencent.com, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, longman@redhat.com, mhiramat@kernel.org, mingo@redhat.com, mingzhe.yang@ly.com, peterz@infradead.org, rostedt@goodmis.org, senozhatsky@chromium.org, tfiga@chromium.org, will@kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2 1/1] hung_task: fix warnings caused by unaligned lock pointers In-Reply-To: <2bd2c4a8-456e-426a-aece-6d21afe80643@linux.dev> Message-ID: References: <20250909145243.17119-1-lance.yang@linux.dev> <99410857-0e72-23e4-c60f-dea96427b85a@linux-m68k.org> <20251007135600.6fc4a031c60b1384dffaead1@linux-foundation.org> <56784853-b653-4587-b850-b03359306366@linux.dev> <693a62e0-a2b5-113b-d5d9-ffb7f2521d6c@linux-m68k.org> <23b67f9d-20ff-4302-810c-bf2d77c52c63@linux.dev> <2bd2c4a8-456e-426a-aece-6d21afe80643@linux.dev> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-DKIM: signer='messagingengine.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.5 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: messagingengine.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in sa-trusted.bondedsender.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 5 On Wed, 8 Oct 2025, Lance Yang wrote: > > In other words, we are not just fixing the bug reported by Eero and > Geert, but correcting the blocker tracking mechanism's flawed assumption > for -stable ;) > > If you feel this doesn't qualify as a fix, I can change the Fixes: tag > to point to the original commit that introduced this flawed mechanism > instead. > That's really a question for the bug reporters. I don't personally have a problem with CONFIG_DETECT_HUNG_TASK_BLOCKER so I can't say whether the fix meets the requirements set in Documentation/process/stable-kernel-rules.rst. And I still don't know what's meant by "unnecessary warnings in a few unexpected cases". From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id eN6+JoAR5mglITIAYBR5ng (envelope-from ) for ; Wed, 08 Oct 2025 07:23:44 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Wed, 08 Oct 2025 07:23:44 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v6OWU-0000000E9dT-3MDW for hi@josie.lol; Wed, 08 Oct 2025 07:23:43 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 092FD19E2D8A for ; Wed, 8 Oct 2025 07:24:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 861762F25E7; Wed, 8 Oct 2025 07:23:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Dee5XhHN" X-Original-To: stable@vger.kernel.org Received: from out-188.mta1.migadu.com (out-188.mta1.migadu.com [95.215.58.188]) (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 99BBD2F1FE9 for ; Wed, 8 Oct 2025 07:23:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759908212; cv=none; b=IUGuwBd99v1C2Rb1hGAcBtEF2e6J1ifUl/AZkz3UQ/hDiQkOiERke2suG3D8ZgzV1gJVoC+MygjeEJi9Jbpkx1s9L1QqqlEJ69t0zPrkRwq2Ev6bZaHKE3Vvttn84du4v33mY/BLG1bJniS1InkY3ORhwgppUCiSAUxey2//3G8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759908212; c=relaxed/simple; bh=1hrKhcewNAog3goQOz9EqxB44PnuDQDFLGTcN9t+kO0=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=o5PtDSaCFQUh+L8yY3GMBvtErDHnBd0UWrMRzwDAUU1vhZFXAHCNfadnGN2opDk+WN4INA5N5wOhZY9dtSYOMWBNWGLFzWB7Bb7MJeLLz71n7jSdFjqlP0ZFzulYEB0K4HGecO5guuEOrw5FddBHYStazxEi18BYYQ4GmzMtaTY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Dee5XhHN; arc=none smtp.client-ip=95.215.58.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: <2bd2c4a8-456e-426a-aece-6d21afe80643@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1759908198; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7UAlSyFCkIOPcSkRc3Lm4Oe7r2DyLQZxHY7cDP0CdBc=; b=Dee5XhHNRi8+jbIjAMSc7VYUoyLS2n5Fa3t+P3S6Vurg1mz0XZURAABYGb6QUH0OX0ytvu R9y2tkbCktxKpZpBFiECWBrpk4I7X8VNSzHe/hxCfx0XrX6P2hPDZZYu2kYvI9tBLyf5ET wji78FEvG+Ukr16/gbwgg6gm6U821MI= Date: Wed, 8 Oct 2025 15:23:05 +0800 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v2 1/1] hung_task: fix warnings caused by unaligned lock pointers Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Lance Yang To: Finn Thain Cc: Andrew Morton , Geert Uytterhoeven , Eero Tamminen , Kent Overstreet , amaindex@outlook.com, anna.schumaker@oracle.com, boqun.feng@gmail.com, ioworker0@gmail.com, joel.granados@kernel.org, jstultz@google.com, leonylgao@tencent.com, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, longman@redhat.com, mhiramat@kernel.org, mingo@redhat.com, mingzhe.yang@ly.com, peterz@infradead.org, rostedt@goodmis.org, senozhatsky@chromium.org, tfiga@chromium.org, will@kernel.org, stable@vger.kernel.org References: <20250909145243.17119-1-lance.yang@linux.dev> <99410857-0e72-23e4-c60f-dea96427b85a@linux-m68k.org> <20251007135600.6fc4a031c60b1384dffaead1@linux-foundation.org> <56784853-b653-4587-b850-b03359306366@linux.dev> <693a62e0-a2b5-113b-d5d9-ffb7f2521d6c@linux-m68k.org> <23b67f9d-20ff-4302-810c-bf2d77c52c63@linux.dev> In-Reply-To: <23b67f9d-20ff-4302-810c-bf2d77c52c63@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-DKIM: signer='linux.dev' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.80.249 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.80.249 listed in bl.score.senderscore.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [147.75.80.249 listed in list.dnswl.org] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: -18 On 2025/10/8 15:09, Lance Yang wrote: > > > On 2025/10/8 14:14, Finn Thain wrote: >> >> On Wed, 8 Oct 2025, Lance Yang wrote: >> >>> On 2025/10/8 08:40, Finn Thain wrote: >>>> >>>> On Tue, 7 Oct 2025, Andrew Morton wrote: >>>> >>>>> Getting back to the $Subject at hand, are people OK with proceeding >>>>> with Lance's original fix? >>>>> >>>> >>>> Lance's patch is probably more appropriate for -stable than the patch I >>>> proposed -- assuming a fix is needed for -stable. >>> >>> Thanks! >>> >>> Apart from that, I believe this fix is still needed for the hung task >>> detector itself, to prevent unnecessary warnings in a few unexpected >>> cases. >>> >> >> Can you be more specific about those cases? A fix for a theoretical bug >> doesn't qualify for -stable branches. But if it's a fix for a real bug, I >> have misunderstood Andrew's question... > > I believe it is a real bug, as it was reported by Eero and Geert[1]. > > The blocker tracking mechanism in -stable assumes that lock pointers > are at least 4-byte aligned. As I mentioned previously[2], this > assumption fails for packed structs on architectures that don't trap > on unaligned access. > > Of course, we could always improve the mechanism to not make > assumptions. But for -stable, this fix completely resolves the issue > by ignoring any unaligned pointer, whatever the cause (e.g., packed > structs, non-native alignment, etc.). > > So we can all sleep well at night again :) > > [1] https://lore.kernel.org/lkml/ > CAMuHMdW7Ab13DdGs2acMQcix5ObJK0O2dG_Fxzr8_g58Rc1_0g@mail.gmail.com/ > [2] https://lore.kernel.org/lkml/cfb62b9d-9cbd-47dd- > a894-3357027e2a50@linux.dev/ Forgot to add: In other words, we are not just fixing the bug reported by Eero and Geert, but correcting the blocker tracking mechanism's flawed assumption for -stable ;) If you feel this doesn't qualify as a fix, I can change the Fixes: tag to point to the original commit that introduced this flawed mechanism instead. > >> >>>> >>>> Besides those two alternatives, there is also a workaround: >>>> $ ./scripts/config -d DETECT_HUNG_TASK_BLOCKER >>>> which may be acceptable to the interested parties (i.e. m68k users). >>>> >>>> I don't have a preference. I'll leave it up to the bug reporters (Eero >>>> and Geert). >>> > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id aJLfJVYO5miaHDEAYBR5ng (envelope-from ) for ; Wed, 08 Oct 2025 07:10:14 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Wed, 08 Oct 2025 07:10:14 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v6OJR-0000000DeYE-0IoJ for hi@josie.lol; Wed, 08 Oct 2025 07:10:14 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 279A64E5A10 for ; Wed, 8 Oct 2025 07:10:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 45BB32F0C6E; Wed, 8 Oct 2025 07:10:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="F5wmyozk" X-Original-To: stable@vger.kernel.org Received: from out-171.mta1.migadu.com (out-171.mta1.migadu.com [95.215.58.171]) (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 6E59C165F16; Wed, 8 Oct 2025 07:10:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759907409; cv=none; b=WBCPWFry78ERbaeEmfbuOR4RT2GnY0Ds3Wwj0SPW0ob7v+vCoMtu2IOVZzSBa/lIb76ftvxDgFEx0doI9OWF7BTamU1Qu3CgYGWimAsmO7g68MeHFrDDpLpxNBZYoBrjeI4dAdVjtIe5xAFjWXg9wJNGf//1pYjhAjFTqNtzPtI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759907409; c=relaxed/simple; bh=VQJRkZRtjm9yYWfgQgpaOG+NO/ZbwOJN3/eg/6wIot4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ud0H+9+SgrTQtHTn2R5pQafjQc1AiEfCc7ikL37QzFvg9GAcgo/cxIXuzJ9LHa8C7unhk10rp9i1bvOscqUh7IgzOEUqfGq/YGl4lLv4ImCHGj31Zzh9vTkdbeyPtzy3QkGI5acfuKAWC1MdUBfJJwYzyANez/OM5FKMcgr06ig= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=F5wmyozk; arc=none smtp.client-ip=95.215.58.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: <23b67f9d-20ff-4302-810c-bf2d77c52c63@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1759907403; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rJE2iJraxcGKQYdozv2wRe9vFO3p9uVwcxrTzZaEgVA=; b=F5wmyozke8Z7AcxH5nXvRJXhnHUNF8spAp2HepNhPC948/KGjmk5rYgOkVRLqqjmzT4gOc nHr3eFtstfJuEyxDUpUpOIJziHjK6CtXqBIlqKmGQmiApZoep+3PGjmiBvDc6RJDQ1OC+c b7/wlbrLmCgrpuixony81PuBKC4BGU0= Date: Wed, 8 Oct 2025 15:09:43 +0800 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v2 1/1] hung_task: fix warnings caused by unaligned lock pointers To: Finn Thain Cc: Andrew Morton , Geert Uytterhoeven , Eero Tamminen , Kent Overstreet , amaindex@outlook.com, anna.schumaker@oracle.com, boqun.feng@gmail.com, ioworker0@gmail.com, joel.granados@kernel.org, jstultz@google.com, leonylgao@tencent.com, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, longman@redhat.com, mhiramat@kernel.org, mingo@redhat.com, mingzhe.yang@ly.com, peterz@infradead.org, rostedt@goodmis.org, senozhatsky@chromium.org, tfiga@chromium.org, will@kernel.org, stable@vger.kernel.org References: <20250909145243.17119-1-lance.yang@linux.dev> <99410857-0e72-23e4-c60f-dea96427b85a@linux-m68k.org> <20251007135600.6fc4a031c60b1384dffaead1@linux-foundation.org> <56784853-b653-4587-b850-b03359306366@linux.dev> <693a62e0-a2b5-113b-d5d9-ffb7f2521d6c@linux-m68k.org> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Lance Yang In-Reply-To: <693a62e0-a2b5-113b-d5d9-ffb7f2521d6c@linux-m68k.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-DKIM: signer='linux.dev' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in sa-accredit.habeas.com] 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linux.dev] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On 2025/10/8 14:14, Finn Thain wrote: > > On Wed, 8 Oct 2025, Lance Yang wrote: > >> On 2025/10/8 08:40, Finn Thain wrote: >>> >>> On Tue, 7 Oct 2025, Andrew Morton wrote: >>> >>>> Getting back to the $Subject at hand, are people OK with proceeding >>>> with Lance's original fix? >>>> >>> >>> Lance's patch is probably more appropriate for -stable than the patch I >>> proposed -- assuming a fix is needed for -stable. >> >> Thanks! >> >> Apart from that, I believe this fix is still needed for the hung task >> detector itself, to prevent unnecessary warnings in a few unexpected >> cases. >> > > Can you be more specific about those cases? A fix for a theoretical bug > doesn't qualify for -stable branches. But if it's a fix for a real bug, I > have misunderstood Andrew's question... I believe it is a real bug, as it was reported by Eero and Geert[1]. The blocker tracking mechanism in -stable assumes that lock pointers are at least 4-byte aligned. As I mentioned previously[2], this assumption fails for packed structs on architectures that don't trap on unaligned access. Of course, we could always improve the mechanism to not make assumptions. But for -stable, this fix completely resolves the issue by ignoring any unaligned pointer, whatever the cause (e.g., packed structs, non-native alignment, etc.). So we can all sleep well at night again :) [1] https://lore.kernel.org/lkml/CAMuHMdW7Ab13DdGs2acMQcix5ObJK0O2dG_Fxzr8_g58Rc1_0g@mail.gmail.com/ [2] https://lore.kernel.org/lkml/cfb62b9d-9cbd-47dd-a894-3357027e2a50@linux.dev/ > >>> >>> Besides those two alternatives, there is also a workaround: >>> $ ./scripts/config -d DETECT_HUNG_TASK_BLOCKER >>> which may be acceptable to the interested parties (i.e. m68k users). >>> >>> I don't have a preference. I'll leave it up to the bug reporters (Eero >>> and Geert). >> From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id HDqsDnIB5mhlVioAYBR5ng (envelope-from ) for ; Wed, 08 Oct 2025 06:15:14 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Wed, 08 Oct 2025 06:15:14 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v6NSC-0000000Befa-3nAO for hi@josie.lol; Wed, 08 Oct 2025 06:15:14 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D59D13A9F65 for ; Wed, 8 Oct 2025 06:15:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8432B1FA178; Wed, 8 Oct 2025 06:15:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="H4pIYGV1" X-Original-To: stable@vger.kernel.org Received: from fout-b4-smtp.messagingengine.com (fout-b4-smtp.messagingengine.com [202.12.124.147]) (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 56AF71EA7CF; Wed, 8 Oct 2025 06:15:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.147 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759904109; cv=none; b=ffQtRW6XGFpWNSy7E+nd3wU3fvaGkpt7B/eeuO8HY8pv2BFrFFFWO+U2GoTNOo4Kognw7fetYG3mw9dJeMqYqjIlqFIb4uU5m758YxEi3MCPazG3ELtbAMacUTL5AVDBInm2pAsfk5cIUwvtbK3yCfF2mt/pi4U7HTIW9lIFXOo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759904109; c=relaxed/simple; bh=/ysWvONG/rRVXYMAmJinyLug2h51k7AZJtFHEIsBFSs=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=SNDVBu9qyDdxBfUxXlau5OKbFqO81Iz8rxI/8Pk0Ij8ESTbN4Nlmd1AGRGUGGwyQppZAHFw92zFj60/sr5pf3eehTCxJcv9jm6A1W/ZPkU9RQi6khbnYJydwx3W+gkEoKV9xOUnENH34UlOS+hqGAIRAcPk+G/cFXRWAFG6oNgg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=none smtp.mailfrom=linux-m68k.org; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=H4pIYGV1; arc=none smtp.client-ip=202.12.124.147 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from phl-compute-10.internal (phl-compute-10.internal [10.202.2.50]) by mailfout.stl.internal (Postfix) with ESMTP id D0D641D000F6; Wed, 8 Oct 2025 02:15:05 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-10.internal (MEProxy); Wed, 08 Oct 2025 02:15:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1759904105; x=1759990505; bh=OR22NrgfEglb+PpHIQeRBTrbvW1PJ4Cuam0 YJIEfV0I=; b=H4pIYGV1EQNs1jQJwTh4cFbdIOIqDSRbUJOrNMgSNleCr1uaDbz 83gtppMOOi95c+qeZe0RZ6vT582FQQ61PIefr9Q4yZJ310MpqhxVG7cj2kaK7tH4 R6Qtmse+wvoJQAPKfkJ9OxTnb8KM0V04PyvutoH0qntdFmDnVWd7neyq5+6jqhD+ X2UTfd1xSNAAczuhzRZIxIhZ/JTdWQ/iKVgmrMDrjKm4O7fPXgNdTgezoH6zR7yA RiB+X5Ep/bT+FXlCqIvQb94rYcoGzq+kMkVr573/rrsyWX3YSyFjo/X8r6jLI1ZJ qkTnRMoUf9OodVOhWmo9IS3w0f05X0II3dQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddutddvheehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevufgjkfhfgggtsehttdertddttddvnecuhfhrohhmpefhihhnnhcuvfhh rghinhcuoehfthhhrghinheslhhinhhugidqmheikehkrdhorhhgqeenucggtffrrghtth gvrhhnpeelueehleehkefgueevtdevteejkefhffekfeffffdtgfejveekgeefvdeuheeu leenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehfth hhrghinheslhhinhhugidqmheikehkrdhorhhgpdhnsggprhgtphhtthhopedvgedpmhho uggvpehsmhhtphhouhhtpdhrtghpthhtoheplhgrnhgtvgdrhigrnhhgsehlihhnuhigrd guvghvpdhrtghpthhtoheprghkphhmsehlihhnuhigqdhfohhunhgurghtihhonhdrohhr ghdprhgtphhtthhopehgvggvrhhtsehlihhnuhigqdhmieekkhdrohhrghdprhgtphhtth hopehorghksehhvghlshhinhhkihhnvghtrdhfihdprhgtphhtthhopehkvghnthdrohhv vghrshhtrhgvvghtsehlihhnuhigrdguvghvpdhrtghpthhtoheprghmrghinhguvgigse houhhtlhhoohhkrdgtohhmpdhrtghpthhtoheprghnnhgrrdhstghhuhhmrghkvghrseho rhgrtghlvgdrtghomhdprhgtphhtthhopegsohhquhhnrdhfvghnghesghhmrghilhdrtg homhdprhgtphhtthhopehiohifohhrkhgvrhdtsehgmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: i58a146ae:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 8 Oct 2025 02:15:01 -0400 (EDT) Date: Wed, 8 Oct 2025 17:14:51 +1100 (AEDT) From: Finn Thain To: Lance Yang cc: Andrew Morton , Geert Uytterhoeven , Eero Tamminen , Kent Overstreet , amaindex@outlook.com, anna.schumaker@oracle.com, boqun.feng@gmail.com, ioworker0@gmail.com, joel.granados@kernel.org, jstultz@google.com, leonylgao@tencent.com, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, longman@redhat.com, mhiramat@kernel.org, mingo@redhat.com, mingzhe.yang@ly.com, peterz@infradead.org, rostedt@goodmis.org, senozhatsky@chromium.org, tfiga@chromium.org, will@kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2 1/1] hung_task: fix warnings caused by unaligned lock pointers In-Reply-To: <56784853-b653-4587-b850-b03359306366@linux.dev> Message-ID: <693a62e0-a2b5-113b-d5d9-ffb7f2521d6c@linux-m68k.org> References: <20250909145243.17119-1-lance.yang@linux.dev> <99410857-0e72-23e4-c60f-dea96427b85a@linux-m68k.org> <20251007135600.6fc4a031c60b1384dffaead1@linux-foundation.org> <56784853-b653-4587-b850-b03359306366@linux.dev> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-DKIM: signer='messagingengine.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.8 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.8 points) --- pts rule name description ---- ---------------------- ----------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [139.178.88.99 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.178.88.99 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.178.88.99 listed in bl.score.senderscore.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: -17 On Wed, 8 Oct 2025, Lance Yang wrote: > On 2025/10/8 08:40, Finn Thain wrote: > > > > On Tue, 7 Oct 2025, Andrew Morton wrote: > > > >> Getting back to the $Subject at hand, are people OK with proceeding > >> with Lance's original fix? > >> > > > > Lance's patch is probably more appropriate for -stable than the patch I > > proposed -- assuming a fix is needed for -stable. > > Thanks! > > Apart from that, I believe this fix is still needed for the hung task > detector itself, to prevent unnecessary warnings in a few unexpected > cases. > Can you be more specific about those cases? A fix for a theoretical bug doesn't qualify for -stable branches. But if it's a fix for a real bug, I have misunderstood Andrew's question... > > > > Besides those two alternatives, there is also a workaround: > > $ ./scripts/config -d DETECT_HUNG_TASK_BLOCKER > > which may be acceptable to the interested parties (i.e. m68k users). > > > > I don't have a preference. I'll leave it up to the bug reporters (Eero > > and Geert). > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id KM+gJozU5WgihxIAYBR5ng (envelope-from ) for ; Wed, 08 Oct 2025 03:03:40 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Wed, 08 Oct 2025 03:03:40 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v6KSq-00000005THE-10jA for hi@josie.lol; Wed, 08 Oct 2025 03:03:40 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D219C3C51BF for ; Wed, 8 Oct 2025 03:03:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 457C92135AD; Wed, 8 Oct 2025 03:03:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="T/3jXx84" X-Original-To: stable@vger.kernel.org Received: from out-181.mta1.migadu.com (out-181.mta1.migadu.com [95.215.58.181]) (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 B166621423C for ; Wed, 8 Oct 2025 03:03:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759892616; cv=none; b=lNiWV+OJ+yVnxSRNbc2JKboQlatxaEeoyN6HnYUhGdGNMuWhFSrjzQjz34hSZmtay5ZPkiybM1JL5+Qam0qbdGTzDkXPnId3PIJtYwh9ZPs3gMKswdo8PkqV6W7pWGvGheev8eLlE9274cibVu7uFPnLpeCo12KEhcmXo0yMkwI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759892616; c=relaxed/simple; bh=5yStW0L1wEARM1VcACJHqDCy7X/TSWEwGB67a2Fqnmg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hf2xwSdrPiGz1jiKnIM8rdi6+JCiuMFz3xfJERQCzznQCIzhqbIhnUb0+vbIbsXbYrjm3x/r71Uzu3pXdHg+e2tUHF2mo570luvGHyFmx1P1o7a0rzHG27lIfzxkhHRW1IxzNe6GWxdYSfZnyhzrTlKe2hQbNlhiga+kjY+6MbU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=T/3jXx84; arc=none smtp.client-ip=95.215.58.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: <56784853-b653-4587-b850-b03359306366@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1759892608; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vSRrtrvWgwS90ySr5nF6OQKQum7o9S6zWNvqm6k9XvM=; b=T/3jXx84Rfw++V6z2MKJJv5c/rPYfsL5Ui23RZkEQx9CDR0WnlRFujpQtx7DTK8morvqzQ fGf+hxuXI0wGprlzykRqYh0W/J+sSVWQbdk1l39Qun/FBJqNpmP2TIBlXlxC4mcFM9II/u MInrvhq4Nld0p1caXSOIDmVSFa3ddig= Date: Wed, 8 Oct 2025 11:03:18 +0800 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v2 1/1] hung_task: fix warnings caused by unaligned lock pointers Content-Language: en-US To: Finn Thain , Andrew Morton , Geert Uytterhoeven , Eero Tamminen Cc: Kent Overstreet , amaindex@outlook.com, anna.schumaker@oracle.com, boqun.feng@gmail.com, ioworker0@gmail.com, joel.granados@kernel.org, jstultz@google.com, leonylgao@tencent.com, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, longman@redhat.com, mhiramat@kernel.org, mingo@redhat.com, mingzhe.yang@ly.com, peterz@infradead.org, rostedt@goodmis.org, senozhatsky@chromium.org, tfiga@chromium.org, will@kernel.org, stable@vger.kernel.org References: <20250909145243.17119-1-lance.yang@linux.dev> <99410857-0e72-23e4-c60f-dea96427b85a@linux-m68k.org> <20251007135600.6fc4a031c60b1384dffaead1@linux-foundation.org> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Lance Yang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-DKIM: signer='linux.dev' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.178.88.99 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.178.88.99 listed in bl.score.senderscore.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On 2025/10/8 08:40, Finn Thain wrote: > > On Tue, 7 Oct 2025, Andrew Morton wrote: > >> >> Getting back to the $Subject at hand, are people OK with proceeding >> with Lance's original fix? >> > > Lance's patch is probably more appropriate for -stable than the patch I > proposed -- assuming a fix is needed for -stable. Thanks! Apart from that, I believe this fix is still needed for the hung task detector itself, to prevent unnecessary warnings in a few unexpected cases. > > Besides those two alternatives, there is also a workaround: > $ ./scripts/config -d DETECT_HUNG_TASK_BLOCKER > which may be acceptable to the interested parties (i.e. m68k users). > > I don't have a preference. I'll leave it up to the bug reporters (Eero and > Geert). From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id ELbAHv2y5WgJ0gAAYBR5ng (envelope-from ) for ; Wed, 08 Oct 2025 00:40:29 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Wed, 08 Oct 2025 00:40:29 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v6IEG-00000000gzS-48m6 for hi@josie.lol; Wed, 08 Oct 2025 00:40:29 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E30C63A5408 for ; Wed, 8 Oct 2025 00:40:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F37462857E2; Wed, 8 Oct 2025 00:40:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="VwdkZqZ4" X-Original-To: stable@vger.kernel.org Received: from fhigh-a2-smtp.messagingengine.com (fhigh-a2-smtp.messagingengine.com [103.168.172.153]) (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 E2F011FA859; Wed, 8 Oct 2025 00:40:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.153 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759884024; cv=none; b=i9T1b80TRU0C0P731yUDzYlt6vu/5MrBARE/gPzSpAubPpnsSg0MPG8g9SsflpzV/rtvxP0Fxx+94SR5s5obYhBE4GY88j8zFFXWqBUJK6/bo1SrkEfbkiKnFuB4Ycpl74rgo69q5xzPEEY1a2P/dhiwKbGjdbql9hwfmUPMKMU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759884024; c=relaxed/simple; bh=4Lj6XaN2MmCn4Ty31dhCcFk/RRrhqYrrk/p2EtLxfgs=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=vDheB1fNuMC2SLvcUvXe+qLl/a/rgJzQNdAgkNPqN1GGRNnjhz6N5B3RS+yP2KTchc46nItR2miuCIjDm/PNDK+Jrc+fZumHj/spuDlj5s/ony93FfCg47CjXUTpAJUl2bLB0Cx7MIlcQ0Mq4kQF8zK4pIGa2hd34uHRaPb4VOs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=none smtp.mailfrom=linux-m68k.org; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=VwdkZqZ4; arc=none smtp.client-ip=103.168.172.153 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfhigh.phl.internal (Postfix) with ESMTP id 229E914005B1; Tue, 7 Oct 2025 20:40:22 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Tue, 07 Oct 2025 20:40:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1759884022; x=1759970422; bh=GIQqrOTmZqlirCfdm3X1h0B9JmIfdK5suLW 7FpXibLA=; b=VwdkZqZ4D9mMNQ50FJ8vt034npGjIiVnaoOm/Cr6hYN0i76aTFC DAX/kfGxEMubDBgsZOKO3wTPxRaVEAQD61LBIhIxHPBJfPWdPLhyUjTwE9/IOaoY c+/Rcd6CM5Pv/PdH3DPRtUqQaGSXMCcKpP9vz4sER/7ixtx3lCixEpauRin/sCYT t2cMvqb50YEo6n/0VTAU4EZUxSATg8uIEMEmFJybkeZEsAJUIruT23P0QJfOQ24g rSZ8es58kqIxlrFbGEBbjXC2G6+wCX72ibbAYIN31Uq++o07ZaEVo6QfNcxlp4JV 4IfZmQXnzsS9Me/lR4hB0GQW1SL25wEyldQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddutddukeelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevufgjkfhfgggtsehttdertddttddvnecuhfhrohhmpefhihhnnhcuvfhh rghinhcuoehfthhhrghinheslhhinhhugidqmheikehkrdhorhhgqeenucggtffrrghtth gvrhhnpeelueehleehkefgueevtdevteejkefhffekfeffffdtgfejveekgeefvdeuheeu leenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehfth hhrghinheslhhinhhugidqmheikehkrdhorhhgpdhnsggprhgtphhtthhopedvgedpmhho uggvpehsmhhtphhouhhtpdhrtghpthhtoheprghkphhmsehlihhnuhigqdhfohhunhgurg htihhonhdrohhrghdprhgtphhtthhopehgvggvrhhtsehlihhnuhigqdhmieekkhdrohhr ghdprhgtphhtthhopehorghksehhvghlshhinhhkihhnvghtrdhfihdprhgtphhtthhope hkvghnthdrohhvvghrshhtrhgvvghtsehlihhnuhigrdguvghvpdhrtghpthhtoheplhgr nhgtvgdrhigrnhhgsehlihhnuhigrdguvghvpdhrtghpthhtoheprghmrghinhguvgigse houhhtlhhoohhkrdgtohhmpdhrtghpthhtoheprghnnhgrrdhstghhuhhmrghkvghrseho rhgrtghlvgdrtghomhdprhgtphhtthhopegsohhquhhnrdhfvghnghesghhmrghilhdrtg homhdprhgtphhtthhopehiohifohhrkhgvrhdtsehgmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: i58a146ae:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 7 Oct 2025 20:40:17 -0400 (EDT) Date: Wed, 8 Oct 2025 11:40:09 +1100 (AEDT) From: Finn Thain To: Andrew Morton , Geert Uytterhoeven , Eero Tamminen cc: Kent Overstreet , Lance Yang , amaindex@outlook.com, anna.schumaker@oracle.com, boqun.feng@gmail.com, ioworker0@gmail.com, joel.granados@kernel.org, jstultz@google.com, leonylgao@tencent.com, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, longman@redhat.com, mhiramat@kernel.org, mingo@redhat.com, mingzhe.yang@ly.com, peterz@infradead.org, rostedt@goodmis.org, senozhatsky@chromium.org, tfiga@chromium.org, will@kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2 1/1] hung_task: fix warnings caused by unaligned lock pointers In-Reply-To: <20251007135600.6fc4a031c60b1384dffaead1@linux-foundation.org> Message-ID: References: <20250909145243.17119-1-lance.yang@linux.dev> <99410857-0e72-23e4-c60f-dea96427b85a@linux-m68k.org> <20251007135600.6fc4a031c60b1384dffaead1@linux-foundation.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-DKIM: signer='messagingengine.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.5 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: messagingengine.com] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.178.88.99 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.178.88.99 listed in bl.score.senderscore.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 5 On Tue, 7 Oct 2025, Andrew Morton wrote: > > Getting back to the $Subject at hand, are people OK with proceeding > with Lance's original fix? > Lance's patch is probably more appropriate for -stable than the patch I proposed -- assuming a fix is needed for -stable. Besides those two alternatives, there is also a workaround: $ ./scripts/config -d DETECT_HUNG_TASK_BLOCKER which may be acceptable to the interested parties (i.e. m68k users). I don't have a preference. I'll leave it up to the bug reporters (Eero and Geert). From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id yEt0J2p+5Wi5fiUAYBR5ng (envelope-from ) for ; Tue, 07 Oct 2025 20:56:10 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 07 Oct 2025 20:56:10 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v6Ej8-0000000AqgR-2n9W for hi@josie.lol; Tue, 07 Oct 2025 20:56:10 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A41ED3B5C4C for ; Tue, 7 Oct 2025 20:56:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 66D5A23C513; Tue, 7 Oct 2025 20:56:02 +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="vpy3OQSP" X-Original-To: stable@vger.kernel.org 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 33DA628399; Tue, 7 Oct 2025 20:56:01 +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=1759870562; cv=none; b=gQHlEarW7cLlMd9MVTCtBsqHDrZogHEyI2fNWefk448oQGEjbaItBUJHGphzazhXRWq1cOgVYGQUb4Wtst7C3rl2oIIFwBSAU63B/pdg2Km4dz+A+kFqSpoYW3kTLD4zW93vaH5PsCrG+jv0fsj4LEU6y5OrIRZpIGOskRTe/hM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759870562; c=relaxed/simple; bh=Gg93q9CWxU5Fuu6tdVUBKMJqQ0HTtVaIEb6Cg6dpU9s=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=SHYR2zpc5/YZmPcYKg4xq0+U7UzslH9tD3IqY6KH6Js0DA2Ykjs+aqu/8mhjBj5p9jmMITvktoRPWitK06PhwkIzRkkbKhsIbzpMXUu5xM45njEuzqfGQHsBT5e1L/gMOvrnGP3ABhG3t7ayZyHxUPWW6nitwbzoJwnCq34uWLo= 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=vpy3OQSP; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F24D4C4CEF1; Tue, 7 Oct 2025 20:56:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1759870561; bh=Gg93q9CWxU5Fuu6tdVUBKMJqQ0HTtVaIEb6Cg6dpU9s=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=vpy3OQSPxKsYHofaY5nTubfqbeqCcI02CR2QjQABytRZminMP/SlUK8Lg0Yy5Rk1t nMiGpw5x0NaHJU4Go+SY3vkeu+6DN8Cn0B4yKwuZUBgyXWkb3Iqa0a++tobdurFO0E JVfOHj0NBLGpUSlj+d3VbUWwq2a0dxVBkpi7QCiU= Date: Tue, 7 Oct 2025 13:56:00 -0700 From: Andrew Morton To: Kent Overstreet Cc: Geert Uytterhoeven , Finn Thain , Lance Yang , amaindex@outlook.com, anna.schumaker@oracle.com, boqun.feng@gmail.com, ioworker0@gmail.com, joel.granados@kernel.org, jstultz@google.com, leonylgao@tencent.com, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, longman@redhat.com, mhiramat@kernel.org, mingo@redhat.com, mingzhe.yang@ly.com, oak@helsinkinet.fi, peterz@infradead.org, rostedt@goodmis.org, senozhatsky@chromium.org, tfiga@chromium.org, will@kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2 1/1] hung_task: fix warnings caused by unaligned lock pointers Message-Id: <20251007135600.6fc4a031c60b1384dffaead1@linux-foundation.org> In-Reply-To: References: <20250909145243.17119-1-lance.yang@linux.dev> <99410857-0e72-23e4-c60f-dea96427b85a@linux-m68k.org> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-DKIM: signer='linux-foundation.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.2 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.2 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linux-foundation.org] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.178.88.99 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.178.88.99 listed in bl.score.senderscore.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.2 NICE_REPLY_A Looks like a legit reply (A) -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 2 Getting back to the $Subject at hand, are people OK with proceeding with Lance's original fix? From: Lance Yang Subject: hung_task: fix warnings caused by unaligned lock pointers Date: Tue, 9 Sep 2025 22:52:43 +0800 From: Lance Yang The blocker tracking mechanism assumes that lock pointers are at least 4-byte aligned to use their lower bits for type encoding. However, as reported by Eero Tamminen, some architectures like m68k only guarantee 2-byte alignment of 32-bit values. This breaks the assumption and causes two related WARN_ON_ONCE checks to trigger. To fix this, the runtime checks are adjusted to silently ignore any lock that is not 4-byte aligned, effectively disabling the feature in such cases and avoiding the related warnings. Thanks to Geert Uytterhoeven for bisecting! Link: https://lkml.kernel.org/r/20250909145243.17119-1-lance.yang@linux.dev Fixes: e711faaafbe5 ("hung_task: replace blocker_mutex with encoded blocker") Signed-off-by: Lance Yang Reported-by: Eero Tamminen Closes: https://lore.kernel.org/lkml/CAMuHMdW7Ab13DdGs2acMQcix5ObJK0O2dG_Fxzr8_g58Rc1_0g@mail.gmail.com Reviewed-by: Masami Hiramatsu (Google) Cc: John Paul Adrian Glaubitz Cc: Anna Schumaker Cc: Boqun Feng Cc: Finn Thain Cc: Geert Uytterhoeven Cc: Ingo Molnar Cc: Joel Granados Cc: John Stultz Cc: Kent Overstreet Cc: Lance Yang Cc: Mingzhe Yang Cc: Peter Zijlstra Cc: Sergey Senozhatsky Cc: Steven Rostedt Cc: Tomasz Figa Cc: Waiman Long Cc: Will Deacon Cc: Yongliang Gao Cc: Signed-off-by: Andrew Morton --- include/linux/hung_task.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/include/linux/hung_task.h~hung_task-fix-warnings-caused-by-unaligned-lock-pointers +++ a/include/linux/hung_task.h @@ -20,6 +20,10 @@ * always zero. So we can use these bits to encode the specific blocking * type. * + * Note that on architectures where this is not guaranteed, or for any + * unaligned lock, this tracking mechanism is silently skipped for that + * lock. + * * Type encoding: * 00 - Blocked on mutex (BLOCKER_TYPE_MUTEX) * 01 - Blocked on semaphore (BLOCKER_TYPE_SEM) @@ -45,7 +49,7 @@ static inline void hung_task_set_blocker * If the lock pointer matches the BLOCKER_TYPE_MASK, return * without writing anything. */ - if (WARN_ON_ONCE(lock_ptr & BLOCKER_TYPE_MASK)) + if (lock_ptr & BLOCKER_TYPE_MASK) return; WRITE_ONCE(current->blocker, lock_ptr | type); @@ -53,8 +57,6 @@ static inline void hung_task_set_blocker static inline void hung_task_clear_blocker(void) { - WARN_ON_ONCE(!READ_ONCE(current->blocker)); - WRITE_ONCE(current->blocker, 0UL); } _ From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id oM1VMqIk7mgO+j4AYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 10:23:30 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 10:23:30 +0000 Received: from ams.mirrors.kernel.org ([213.196.21.55]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8cBm-00000001YeE-25T9 for hi@josie.lol; Tue, 14 Oct 2025 10:23:30 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.mirrors.kernel.org (Postfix) with ESMTPS id 1CECB34D4A2 for ; Tue, 14 Oct 2025 10:23:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D83E02ED14B; Tue, 14 Oct 2025 10:23:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="kL1xS8E5" X-Original-To: stable@vger.kernel.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 45D6F27F01E for ; Tue, 14 Oct 2025 10:23:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760437405; cv=none; b=LjjC53Day9/Aj8vL5KQCJGpefTVwnlIYEVKY/q3iErFXheFcUycIMQIaLjlYWxTjM1R4EjTgs+4r8cp6/1rsFA/RquwHU74kN1Ul17OSQBbfwKkCBdB9m9JabCXMwuB57tDb3PDSTxjsZbLtsgj5tXvLgjqLnicmc6OY+7JKN4k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760437405; c=relaxed/simple; bh=dka1hLAB2FDL4jzoGIfRpvi/9wOSg9e0OUQPD939vAo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tZTTXepk1I06oBiIHfWccX7hL1C28qBOw4DydV8NTJ+6aog4gTvn9EyIvRPZfEHJWzJZQCPOhYcIeSf3go5hdp1V0FpjNded2bEahynXnXpcAolBxauoDbgh8aL1oauda5gq2mBiYeYjS/W9HEKOQ/FAZwWKwmEr1lvxvZkrHVI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=kL1xS8E5; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 59E87Lhx008653 for ; Tue, 14 Oct 2025 10:23:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=qcppdkim1; bh=/q6kggVv0I8zQ7jGT2QmEA7M QI9ZTL3uoZuqj2yT2cM=; b=kL1xS8E5F3Es/ScguvWjy7ncewgbUzmnaLwzxTTT VNVloJ/pWk59upqJNNFE+mKZBL9Ho0Wjx8h96ECdVr21vEHQBFllduAVWyqr1+Tc GIFvE6Djg8LoVF1PW1DRhYTrQdIaNoNm4Z4ZcBpvmghtbuBQdm4y7j42tQWerZwL LtK6ELPdy8ZIgBmRMOVH15Ok4b4S/p4iKKk9sIuuvBuuZuq9zW8yJvwJWmJsQJaj xWij3J+PPAmXAHBd6lT8UhJ2q7VgXrxuUqLWT3mPHJsydFbMDjfz2pqYQwSn8Pqy KqwHjPBGv4Yck2jc1//GOLK42IlW8gwIhK9S6OZ8H+KpkA== Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49rtrt4w97-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 14 Oct 2025 10:23:23 +0000 (GMT) Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-827061b4ca9so2400642185a.3 for ; Tue, 14 Oct 2025 03:23:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760437402; x=1761042202; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/q6kggVv0I8zQ7jGT2QmEA7MQI9ZTL3uoZuqj2yT2cM=; b=hsMkeOKiroUV20fOWLRihNEGI6KxAmVQoWZ+AJkgYxyCFBBILEn6Bg7y2iJuWgGAED 7bozy6J0allAbLcrzPVwIqvbWWHycrybgegwysEcMQGpMT2IQBi+3PjWMSBBf91mooQE UHmfQ+HLxwaD1jHOxOmv9/IcTUhjJVM/DHZcT10m6L2E1917+gcoyKrwaDWTDsyAndwR fcE0YJ3PmkyxW3KaNofT07BOOXJLYdqxPa79d7L2eqw8Gq3y00qKnM26Ki5bUVy8guo9 lUeI+/FNE+/gltFqGXKPO+RVkzoNi9kDd1qd/fF5DUHvzV6bhR6AgHwuWNe8xKnernS1 NvlA== X-Forwarded-Encrypted: i=1; AJvYcCVdRkkHRPixGFZD/sOFWd0Yus8PX4YdeNwELZfT2CJjNe99pfSqfYmZ8nlvrB14laECzFDmO/M=@vger.kernel.org X-Gm-Message-State: AOJu0Yy1hu8ic0Dg+bXxXJOFEni+ZfL2PwMloyZIt45J4RO5VQw127H/ H/Nk+HSN08Tis/HvpirTzjQx6QY3I/TIfRiMwvViV0XhUwpnP933PkIV5y8gVte6APpL6uVaUDy tJTS76XaUomqwggerLWfWsZoGJduLxFptNm/qLkO7jNsP/jHDWRwIVDoStGQ= X-Gm-Gg: ASbGncuH3GVltlpCVBuEHztKDnXfcJmLIz+ZLMfk0cEmaJqcbXDQVO3r0bxXJOkPNyv V8UKSZl+oXoq223H8ry+ohWbvo5o7wKLMi3WWE2s8pR8SmLp8yCo8nf0M0wzvmSGGLXA2ZTDkZO 8RGX6gPzGLekQcc3It47zSg8ea04TkvcjPvUHPloVPrOziO6Gq9P+5qRHH6X+sW3oVCS80OCtB5 rZ5nBLWZYNBN+nSXez/h1BxiyigwB5ejSVcAGRIFg2W6KfCxCBbN8R1RchOSi85zGwPvHozhgft XLPdIRQ+6orOp3NXUGs1G4wjbFZ/A0CikzgDuzPPihfMj6a4Fz3SbDUlo85pq2mxPLzJoE4snlO 9eys9sUdn/ty+kP8S/6t9uw/EtvVO9Uapb79qvzmcXB1bFwpzjSte X-Received: by 2002:a05:620a:bc5:b0:85f:d78c:579f with SMTP id af79cd13be357-88354019979mr3300405885a.80.1760437402464; Tue, 14 Oct 2025 03:23:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFWXH1WiqeKRdg/ZhH41/VhdoA1bJDjANkssxaTXJhlGef6O0WTcMGo77Oq7bI7MfQwSpsR+A== X-Received: by 2002:a05:620a:bc5:b0:85f:d78c:579f with SMTP id af79cd13be357-88354019979mr3300402785a.80.1760437401998; Tue, 14 Oct 2025 03:23:21 -0700 (PDT) Received: from umbar.lan (2001-14ba-a0c3-3a00-264b-feff-fe8b-be8a.rev.dnainternet.fi. [2001:14ba:a0c3:3a00:264b:feff:fe8b:be8a]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-590881f92casm5118341e87.43.2025.10.14.03.23.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Oct 2025 03:23:21 -0700 (PDT) Date: Tue, 14 Oct 2025 13:23:19 +0300 From: Dmitry Baryshkov To: Abel Vesa Cc: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Dmitry Baryshkov , Konrad Dybcio , Sibi Sankar , Rajendra Nayak , Krzysztof Kozlowski , Neil Armstrong , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH RESEND v3 3/3] arm64: dts: qcom: Add missing TCSR ref clock to the DP PHYs Message-ID: References: <20251014-phy-qcom-edp-add-missing-refclk-v3-0-078be041d06f@linaro.org> <20251014-phy-qcom-edp-add-missing-refclk-v3-3-078be041d06f@linaro.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251014-phy-qcom-edp-add-missing-refclk-v3-3-078be041d06f@linaro.org> X-Proofpoint-ORIG-GUID: nLJDISUyYyJ9mKOpwc4HpNpgSN47Ml5v X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDEzMDAyMiBTYWx0ZWRfX9GZLjvH+pOuB lOpSzUbCheaaA418pLJ6/t2hoNSOJ2c1qE0sQDRMEuAoOTYRdyNiDBaWzLMbuM1aYgUB274i4QD mp0uob/Ki8z1CK87kRycKo+MmImOun4y6aiMk7XDz7tRhL3jeo2Lub58oRUz+Pl4BTWbtC7l5yS qDpQKYQOi5hfLsojXK71pS3NA+iKsp0QxlZ776NSx1XGUEPqdCz0X3QBx49WPBUupK8KS95T+1H C6IvGd7lwm7Vn9cDo9sKLazT/oC3X9mT4Kh8i4m2G3kD/jueo3ClqZwC/Cpzvz5AvI4rWBa/5dB +GxjPwEUFZ/+voS2w+UYhKnOGZBXaNiYBlVNo/v+tEDhYd+3k31Qb1zlRq3g07SEsOurUi+FYEm pNi3mOPWBvSlN/yDIe82C8eJdF3CdA== X-Authority-Analysis: v=2.4 cv=SfD6t/Ru c=1 sm=1 tr=0 ts=68ee249b cx=c_pps a=hnmNkyzTK/kJ09Xio7VxxA==:117 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=x6icFKpwvdMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VwQbUJbxAAAA:8 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=bvtlJ27tT1nIeLj7f_gA:9 a=CjuIK1q_8ugA:10 a=PEH46H7Ffwr30OY-TuGO:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: nLJDISUyYyJ9mKOpwc4HpNpgSN47Ml5v X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-14_02,2025-10-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 clxscore=1015 adultscore=0 phishscore=0 lowpriorityscore=0 bulkscore=0 impostorscore=0 priorityscore=1501 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510020000 definitions=main-2510130022 X-DKIM: signer='qualcomm.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.5 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: qualcomm.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [213.196.21.55 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 5 On Tue, Oct 14, 2025 at 12:46:05PM +0300, Abel Vesa wrote: > The DP PHYs on X1E80100 need the ref clock which is provided by the > TCSR CC. > > The current X Elite devices supported upstream work fine without this > clock, because the boot firmware leaves this clock enabled. But we should > not rely on that. Also, even though this change breaks the ABI, it is > needed in order to make the driver disables this clock along with the > other ones, for a proper bring-down of the entire PHY. > > So lets attach it to each of the DP PHYs in order to do that. > > Cc: stable@vger.kernel.org # v6.9 > Fixes: 1940c25eaa63 ("arm64: dts: qcom: x1e80100: Add display nodes") > Signed-off-by: Abel Vesa > --- > arch/arm64/boot/dts/qcom/x1e80100.dtsi | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > Reviewed-by: Dmitry Baryshkov -- With best wishes Dmitry From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id +PltMZAk7mj/EAEAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 10:23:12 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 10:23:12 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8cBU-00000001Y5k-1yC9 for hi@josie.lol; Tue, 14 Oct 2025 10:23:12 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id ED95418904C7 for ; Tue, 14 Oct 2025 10:23:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 15C4F2F49EC; Tue, 14 Oct 2025 10:23:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="VRSU2J++" X-Original-To: stable@vger.kernel.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 89CED27F01E for ; Tue, 14 Oct 2025 10:23:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760437387; cv=none; b=hewnlCf8KtMia5EwgTAbb42sJz/m3s4fSo9nhDF6Bqd/YeKuXLAzYz7qAyoCpqtFkGEXc5CbK1Zhl1/rHPAn6IrxUldzamGluUGP78FmRIWWSjL0XHf/Dsh1mEP0ajzDF6Y6kp7wr6HJ5Fn8TVH3X7DkcvGIXLErtnhfLAMlmUk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760437387; c=relaxed/simple; bh=z2WdTcRaPaqI49kofZEevWYMKxOmtfhm/A5grF0PpaM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=AwFEnCOiF8jxq00XyLOWVzm8bL29YstDQIoIFIquuWn7JOB7hZODB66bzDzV6jkeu79/SqFgrLc0WGsdJXkxCQ4TrevBFmJ7P13xuBlI/Tr5zcapTOCUDipu/3gyz55qfAGehtxeGSjIbNkPhmkE/E725XEpcS9MctAuP0affgA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=VRSU2J++; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 59E87Osk021230 for ; Tue, 14 Oct 2025 10:23:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=qcppdkim1; bh=7Uj/7ATN4u+TUQSCAcK5UK3n NiApttHLG6ztUMcWXEg=; b=VRSU2J++mFCvHkkvlPobpzEbjhkwJV0p7WGrp0r+ UjH3mQUV13vruv4FO2uxwDRPrADDOInLQv2JnjQyDNUP7Lkong/krzOmlPwmCOy8 ZNqs2ZWM2LNxKkUhBExih9/bDjHRuQuw1WBHEImnX21c/MESQE0dg/5i4AgVnIf5 KmS9K8ZjJtXkJq5b1oqVodMmXczMx0WlJOiAAMNrFJ/tk3QUSuQyT5w2kTXEAlCU PpKLs5Sj51AMed4iEmIkoLOCupi4gaG+ed0bm+O2hSpE20UFf/jFYLNIDYDUNtpP wPIU3PEQNjN3wbGf3fS0QUkKN8ekqfNAm4NgzSCMaF1N8A== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49s6mwjcfc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 14 Oct 2025 10:23:04 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-872d1a88c7dso816879685a.0 for ; Tue, 14 Oct 2025 03:23:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760437383; x=1761042183; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=7Uj/7ATN4u+TUQSCAcK5UK3nNiApttHLG6ztUMcWXEg=; b=PeZLgACxNXoGfwGUekhfiQFXfwjDWxdxwy0OvBw9ENoImXUt30WfBDjYOu2L+xqO4N x1rPPzMmLNWLdFSsVgVz9UedgTWIacwRbfU8BN09KfDFYnwzYNBidYIh+rALO+M/bUUx J8TQaZ/rN6IR8WuhDrQ5uoOOYYOgwPaB+YEz4+/NmUoA8UfBuiyntnw+4Otx623mrACX A2CqaDEVLKL0p0VCGbN15e2ekG/JSIjIB0NPYq3GmRHMeDSHfJKIwg6aNoiDH0oPEWCL h968KGBgsf4Y96fd2WjmHGqUbKEF9N/zWIFw+Ftv0833MUECOayvB/cpe1whGy5TKnL0 PrgQ== X-Forwarded-Encrypted: i=1; AJvYcCVyzuMu7/YHO/Ym5dK4gp23f7IX1jXzPgzRDqgOdET/zP69DP6fhMMBrUgDRXVP0+03NF5tA7A=@vger.kernel.org X-Gm-Message-State: AOJu0YxH827JEKx6qQQf+YEAeYbacMGoYo9JRK8JyibtC03MSulLGIR/ MnsOucsbhZx6+PUrpjS3a2XEuGrf/OQo98e3BUE1WbMTEagntmsruzBipTwaLyHx/v/3p52+0d9 /3f5Lvozd2mDfdRoSPKB4JAzuQq2+UVYxuxRI8eXPSFSHoalI0awnqgzx56Y= X-Gm-Gg: ASbGncso2YJCG3KNpgIr3uHce3z6p7sA2sKXS636D8Qs1Le6NnSeuHH0vAT+2QPTAmn S8H2eug536KWLZo4h+i2zSOdgbXx4tiD/lO+1NIcnIIYvqGbhROdgGNLIsCt1DMmqhwmSDss0E5 1AO+MpkpI5/Yhbh3pwOpdHN2CCAccodf8SeVbbQq98lchKwNlSywGiBprXxbat6tbfHaWVcoIfB Isy94wErx7Jjvf1ddrshG3E1lZi3kXGbpjzeFXRKpTpxBC2c8tqOcNnY4BA3nSMhuelvy1LDaxg bJZGnssf56Gr2XeTu5cEHaHxp/2L0gIj9cPit9mfZXe/gfKTYnEr8LiGIgJcoIwmOQfY3brsfTS hRqsrkL/TQZbfg1UpMtPt2eGXWzEHM8pnhqn54h+XVq4B8ISoK1k8 X-Received: by 2002:a05:620a:440a:b0:82b:3775:666e with SMTP id af79cd13be357-88352ab09d7mr2876979985a.36.1760437383491; Tue, 14 Oct 2025 03:23:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFpI9b1UGkdarxfxY2my6QGIRQFNyBFabsw/h2nYcLI4je0hd8JsX+xtryHXf3lrxskF2pXZQ== X-Received: by 2002:a05:620a:440a:b0:82b:3775:666e with SMTP id af79cd13be357-88352ab09d7mr2876976985a.36.1760437383043; Tue, 14 Oct 2025 03:23:03 -0700 (PDT) Received: from umbar.lan (2001-14ba-a0c3-3a00-264b-feff-fe8b-be8a.rev.dnainternet.fi. [2001:14ba:a0c3:3a00:264b:feff:fe8b:be8a]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-59088585765sm5122059e87.127.2025.10.14.03.23.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Oct 2025 03:23:02 -0700 (PDT) Date: Tue, 14 Oct 2025 13:23:00 +0300 From: Dmitry Baryshkov To: Abel Vesa Cc: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Dmitry Baryshkov , Konrad Dybcio , Sibi Sankar , Rajendra Nayak , Krzysztof Kozlowski , Neil Armstrong , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH RESEND v3 2/3] phy: qcom: edp: Make the number of clocks flexible Message-ID: References: <20251014-phy-qcom-edp-add-missing-refclk-v3-0-078be041d06f@linaro.org> <20251014-phy-qcom-edp-add-missing-refclk-v3-2-078be041d06f@linaro.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251014-phy-qcom-edp-add-missing-refclk-v3-2-078be041d06f@linaro.org> X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDEzMDA4MyBTYWx0ZWRfX7DCvdXyhsHmo Ox2Jzi/zHTcU4MSnfhKANPGXdy6Uz1kyJO51/YCiu4Outr3Iu4kDn1EdKJVA1SojfHIINT9moxR 5ulHj30xYNWamY/+PFwdc80xObLiTmbzao1K3/va0L6N4zedP7C9uFd+h7STgc2uCuBTdCIx/ab zHCoDIDQpFySQ8ao8UYYno+p//ULNB4CUJMIUih9++UrqUQsLMD7fM95d07xGDhUwJ95NyvTrMt 6x33fQHizHtJbYW5bgdcsINIlWX3G30deo3zJ2F4OIBJoHoo/51+Qs8XEsLNvPEKpD9I74rRqE+ PE6z9Fc7fOhgTG1IzBQH8kbijSoTYCZOXpRKIfdO0SDzMtIdwZHguoyi6PUk30jXI/W5wkl9LBp yko1Me/F6gv2uU+z5PTtlTHHdKZBBg== X-Authority-Analysis: v=2.4 cv=Fr4IPmrq c=1 sm=1 tr=0 ts=68ee2488 cx=c_pps a=HLyN3IcIa5EE8TELMZ618Q==:117 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=x6icFKpwvdMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VwQbUJbxAAAA:8 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=77Gn-jvO4NWksBu-1S8A:9 a=CjuIK1q_8ugA:10 a=bTQJ7kPSJx9SKPbeHEYW:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: nV7_VqklVzKwgO3_j5u1MqRx3dceTmXT X-Proofpoint-ORIG-GUID: nV7_VqklVzKwgO3_j5u1MqRx3dceTmXT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-14_02,2025-10-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 spamscore=0 phishscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 bulkscore=0 suspectscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510020000 definitions=main-2510130083 X-DKIM: signer='qualcomm.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.5 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: qualcomm.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.80.249 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 5 On Tue, Oct 14, 2025 at 12:46:04PM +0300, Abel Vesa wrote: > On X Elite, the DP PHY needs another clock called ref, while all other > platforms do not. > > The current X Elite devices supported upstream work fine without this > clock, because the boot firmware leaves this clock enabled. But we should > not rely on that. Also, even though this change breaks the ABI, it is > needed in order to make the driver disables this clock along with the > other ones, for a proper bring-down of the entire PHY. > > So in order to handle these clocks on different platforms, make the driver > get all the clocks regardless of how many there are provided. > > Cc: stable@vger.kernel.org # v6.10 > Fixes: db83c107dc29 ("phy: qcom: edp: Add v6 specific ops and X1E80100 platform support") > Signed-off-by: Abel Vesa > --- > drivers/phy/qualcomm/phy-qcom-edp.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > Reviewed-by: Dmitry Baryshkov -- With best wishes Dmitry From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id aKziCFwc7micoD0AYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 09:48:12 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 09:48:12 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8bdb-00000000QBz-1hoJ for hi@josie.lol; Tue, 14 Oct 2025 09:48:12 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id F0DCF1923908 for ; Tue, 14 Oct 2025 09:48:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B2A8830FC2C; Tue, 14 Oct 2025 09:46:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Ob4eJLwL" X-Original-To: stable@vger.kernel.org Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1BB643093A1 for ; Tue, 14 Oct 2025 09:46:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760435202; cv=none; b=J7LibKU2Q0w+wD3pby76C/5lXT9YnTMD/Z6x5lUAKKB+jIoCO+j6Y1Cr6KTw0ttVOdi3kgAMHR+yGmpYZa94dp+1INr+Bw1o3nHgsaZK9ogTVHgpxKBR5mb1bG6QSKFoD7PDQAz3JdpMSUAIGcvC+6rhJtD9kj3SUcvzqHcdhmA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760435202; c=relaxed/simple; bh=lMgoKm6fFriFGTk58UsXdD/s6UE1JLiRxIhK+/XA3EQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Nl9ffI13DtYv6Ln/8Jc65CUYJNoP1Vk5DBg1tAIRF1Sw1Y4LF/UHe7yS8pYLKJXXysUMRf9Qx7YYQPyM9GaIavxYoA15a5zOKjQwsfji+pnjMwHLl71306k0KMTQqEHinOgp5K5YMKnDj5ey3R4YE39fvj2lN86U2M58RhifquI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Ob4eJLwL; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-46e3af7889fso27761785e9.2 for ; Tue, 14 Oct 2025 02:46:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1760435198; x=1761039998; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=xUaeped6AYTKx4zcDVin/2JtzA4/FqNOiGDU51UI8HM=; b=Ob4eJLwL1jy5pdRhSy987E5TWW35fjW5cctory4ljaIm6T/OVyYBzqaEBwf65aIFon tnFru3b/yIYBGGNisorW8FtjK/q1mmXAlmOHPPI5El/x6o8JPqiXOPzGttdHX2UC5pVB SRgeHMu3PFfLg6ubDEEKzlKkuC9OzOGZZ4DO2aAIoTkneiLzkj7fmXqE36P//IWzR1DQ n3inH0D6W4LBTDgLYQOJxod1DJSYnIsnK+QUjPVjDwOAywSvBM2hZpS69GDTaer1osZQ HKizZA8wEJuVgHFo/R/YHGMjPdO5r8P/cEIaoGMvPZKDDpMfCK34v2fMcQc7KXcWOH7j 24rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760435198; x=1761039998; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xUaeped6AYTKx4zcDVin/2JtzA4/FqNOiGDU51UI8HM=; b=DUVnk3xK59e6bakz8UzzIVhEGlMXYYBCiUhv1RDSZwK3middqe6T2t8ik1sFXvzL4M WfVcor9b+8sl+B2QZ9acY+PcKxRLKzhqy8shb8gOVMFH/2Gjz03/GqVfXXt3zs5sw3JY /44NwtPHxSpEglPoff820RC1XMJ/RTW7qx9ftZu4dC2pLmEPcNRb/pYPQZibxmXCCNpR LZDoYyZuABFXmCr1LlBCt0Okfeb6w+OSZKCVcDcWCD3mLr3xcqDQxMPWAxD8byoVxZnp gR/NPP5bLKIUFFPrmVbxZ7QAhNdX4iFOB5FJ2o4/Bo7GLcgLbr1e36PJhe7gM2tYI0cR CVlQ== X-Forwarded-Encrypted: i=1; AJvYcCUxEw2C+3Ew7rhgjm/7ZN3BnKFdPxeCQAWS6UKF2TVRx2iCkN8Edhb3lr/pLnYhOHOOjN2qftU=@vger.kernel.org X-Gm-Message-State: AOJu0YxErW+M9mPiPD3J18p0q/4WcKGYXPWAtWaz6iVxLoONONRn3NXG V45kMKSwP2Ui/kQ93VkFOTl9kfiHEewbSWMQGJMc9e1ZJJhGz2STnKQSl3QKAUm5sGo= X-Gm-Gg: ASbGncssuA6z0KyytuWQFzjsZ4YMhcOFL/K+iQv/lg6oJEPb+V3bM5XZhfQZfc1dV0W cco3JUD/eUQH7p/VYzLHFPc6SfPiZjRlJpyhSjzZMPngdJUZLpM1apcMX4ay0bpJ8LIdzL257Nc /syCiunPjJuEe9YoVGF9PTJQqtkwFFmwN13xLi/ZIYKXAzhSHlSUunl4RaXFs8m6IQ2j6KaMfc7 AGkYFPw6EyOXi8oXaTW8yKxS0r005DvLIpGCiAzvMQe/wxfGw18JZokBci9eotfNWrGYX3Tvntj uyPZISUa/xuFcyG/RbbAvhnHfxFoelUGDCJvuTZXftB5OdipQoX7uFk5XclTfgK5K21U+I+gJIs zIPClGQWmV9xTzlU9QLt76Ty/H7nbRuxwtyBdbzYQ4cMJ3ByIhnbOxZ3cTDHnInPo X-Google-Smtp-Source: AGHT+IHF94BpDjyQHISB3YpTos3ClDnO2QEk9OvNMWaiACfwfHscIkvvEEFe8GflJANQQTK/kZpUVA== X-Received: by 2002:a05:600c:c096:b0:46e:2cfe:971c with SMTP id 5b1f17b1804b1-46fa9b937e1mr113989105e9.0.1760435198283; Tue, 14 Oct 2025 02:46:38 -0700 (PDT) Received: from hackbox.lan ([86.121.7.169]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-426ce5e8b31sm22866442f8f.54.2025.10.14.02.46.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Oct 2025 02:46:36 -0700 (PDT) From: Abel Vesa Date: Tue, 14 Oct 2025 12:46:05 +0300 Subject: [PATCH RESEND v3 3/3] arm64: dts: qcom: Add missing TCSR ref clock to the DP PHYs Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20251014-phy-qcom-edp-add-missing-refclk-v3-3-078be041d06f@linaro.org> References: <20251014-phy-qcom-edp-add-missing-refclk-v3-0-078be041d06f@linaro.org> In-Reply-To: <20251014-phy-qcom-edp-add-missing-refclk-v3-0-078be041d06f@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Dmitry Baryshkov , Konrad Dybcio , Sibi Sankar , Rajendra Nayak Cc: Krzysztof Kozlowski , Neil Armstrong , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Abel Vesa , stable@vger.kernel.org X-Mailer: b4 0.15-dev-dedf8 X-Developer-Signature: v=1; a=openpgp-sha256; l=1849; i=abel.vesa@linaro.org; h=from:subject:message-id; bh=lMgoKm6fFriFGTk58UsXdD/s6UE1JLiRxIhK+/XA3EQ=; b=owEBbQKS/ZANAwAKARtfRMkAlRVWAcsmYgBo7hvpvtZYMOOjNeP/WxoC05ERCeQIn31ePA6ou KHQQL1n7NiJAjMEAAEKAB0WIQRO8+4RTnqPKsqn0bgbX0TJAJUVVgUCaO4b6QAKCRAbX0TJAJUV VjkFEACACdNyGShHB0VCbqgl3wmaUbLAiFR1/ZnEk/ntbJYOWJBHthyNxhu6Kwq2S+xgChEcJ3C QZEC4bm0PJK353jPGQV+PvNWHLv5P4m2njVLdNctNau9asqqoyyjwwhOlGn4xS6Oi/p33yl87II +8CtFUZ7Lx4XirqFhNykxJ7QjgbsgZnMJmrRC906I9ps+TaOe1DtxTXP3sozR+NA6Q6nbz1YT1R 4mhAmHzCiMGo+89DwZsUhkKIoVSrq9kV4D4p8Gi4tRwhTuGIpBl7bT5HLNOzWzaJwEc6B8HikTX rkpx2ZneYmmtu+UkRp6ZhJ5B0M7zuZC4TPxm5UGJUGtWYwv1MklakNYZLq5nfo/mi4Xa/zYwXbd nqM2eynJEMLpctZoXnC37DG4V8GMhsWIapXT4aXBRoY0gAZQbSGfS7nJYez4GewE531xVEB8ZpN B194MntxyQ2ezz9uk76VlkMua8dQkKf1IerZX1NIn/0COX0MfC0oxpQhWO8V5cjrg1lANTgKWP4 h0zCHgiS76+ux8b/syakZ6yz609Ka34j1+l0QNMZHtTwOCoBecT8/AtUpzSi9w/9slJ1/q/Vx8e Mc6fUI0oevA6qCEEiUnZmqkabLH7VpJT17idYRfFGCazycy+HrDbGL7lQ/GHo1miGw1dPT9BU24 j0PBwMhOV6uhIMA== X-Developer-Key: i=abel.vesa@linaro.org; a=openpgp; fpr=6AFF162D57F4223A8770EF5AF7BF214136F41FAE X-DKIM: signer='linaro.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linaro.org] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.80.249 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 The DP PHYs on X1E80100 need the ref clock which is provided by the TCSR CC. The current X Elite devices supported upstream work fine without this clock, because the boot firmware leaves this clock enabled. But we should not rely on that. Also, even though this change breaks the ABI, it is needed in order to make the driver disables this clock along with the other ones, for a proper bring-down of the entire PHY. So lets attach it to each of the DP PHYs in order to do that. Cc: stable@vger.kernel.org # v6.9 Fixes: 1940c25eaa63 ("arm64: dts: qcom: x1e80100: Add display nodes") Signed-off-by: Abel Vesa --- arch/arm64/boot/dts/qcom/x1e80100.dtsi | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/x1e80100.dtsi b/arch/arm64/boot/dts/qcom/x1e80100.dtsi index 51576d9c935decbc61a8e4200de83e739f7da814..0db5183cb4c4ea984d6a47987a1a165cacb3c4e7 100644 --- a/arch/arm64/boot/dts/qcom/x1e80100.dtsi +++ b/arch/arm64/boot/dts/qcom/x1e80100.dtsi @@ -5817,9 +5817,11 @@ mdss_dp2_phy: phy@aec2a00 { <0 0x0aec2000 0 0x1c8>; clocks = <&dispcc DISP_CC_MDSS_DPTX2_AUX_CLK>, - <&dispcc DISP_CC_MDSS_AHB_CLK>; + <&dispcc DISP_CC_MDSS_AHB_CLK>, + <&tcsr TCSR_EDP_CLKREF_EN>; clock-names = "aux", - "cfg_ahb"; + "cfg_ahb", + "ref"; power-domains = <&rpmhpd RPMHPD_MX>; @@ -5837,9 +5839,11 @@ mdss_dp3_phy: phy@aec5a00 { <0 0x0aec5000 0 0x1c8>; clocks = <&dispcc DISP_CC_MDSS_DPTX3_AUX_CLK>, - <&dispcc DISP_CC_MDSS_AHB_CLK>; + <&dispcc DISP_CC_MDSS_AHB_CLK>, + <&tcsr TCSR_EDP_CLKREF_EN>; clock-names = "aux", - "cfg_ahb"; + "cfg_ahb", + "ref"; power-domains = <&rpmhpd RPMHPD_MX>; -- 2.48.1 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id +EWSG+kc7mhoZD8AYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 09:50:33 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 09:50:33 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8bft-00000000Ud8-0UOe for hi@josie.lol; Tue, 14 Oct 2025 09:50:33 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C6E915422EB for ; Tue, 14 Oct 2025 09:47:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D7625308F1F; Tue, 14 Oct 2025 09:46:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="lcTUX/ej" X-Original-To: stable@vger.kernel.org Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80D412FB97F for ; Tue, 14 Oct 2025 09:46:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760435199; cv=none; b=A9l2vjxbs16z2bI5ayqLdU/qoGy3sXbc+PEB5GYcPPxtgRBhVG08jlzCrgraS5fx87UeIlKwWgKxHUfxJHASE+eCvBwfrOUkARHH/twZf33J8NuLYJnV91jvI7BaY38AEp7/LWRTimPobeZ1UT6xchbZ7JqJH+ssOTapuvwXmkw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760435199; c=relaxed/simple; bh=Zz2R5WmG71VGhvfhWPgwTOijPEaexpycDrO5L76SRq4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tOM2A8ParYWCcR/p34qPKUf850hYyb34o0Gv7ngDyQ5+RlLr0qr+fdu3kQE+jFZxVrLXqu7SC9l0vIgWnBaZwaNDZ0B0S8vo1WQfRCZqXx/N5u8PMt/1vzKnbXKYAa1KbWMV32NqR/FijlaLCfLs5BDKLdZF6nZ70a+mJCXIKv4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=lcTUX/ej; arc=none smtp.client-ip=209.85.221.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-3f2cf786abeso4401406f8f.3 for ; Tue, 14 Oct 2025 02:46:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1760435195; x=1761039995; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Bzu7zb69wVj+tqTtPM7cxHp0BkBV/6RIMLEciU347jg=; b=lcTUX/ejkRbzORzr9IPK9zhFnjyNhudJmksebExeKVirj4jbMtYllsoK1erLiuI4xb IiyfsmCc95W/xCu5HaWZjmvqWPvj3TpEs8j/R0S0dR4DtS+/VlKHVsJuyMAYHhPzcu1B Um9W0uX5NZwp7cJJo5J5QQeYL1CEqMdrkCDr9BhR6/sWaZsJvSNZmM7RtML5Dql/nJ4n MSwLladLX2cDgM9/CqkaAaiohAyG+VjaeY28L4qYkZxuZVtgG1RXhNbNNpxhF7jCaEGG 857mWTmgcaleZjcVlXbWiemRx9Uxa0bFP9EPw7c/a6UVdmnZHksSQbnwI7e09Vs16e3x 44Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760435195; x=1761039995; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Bzu7zb69wVj+tqTtPM7cxHp0BkBV/6RIMLEciU347jg=; b=LhiTTnxEVBQc+p2e2lkWwXCo2X53k6Dox8SPmrpH56iaDDo+fjtINhaUk3eY+aE2VA dndbKc+kKu8UqGZ7HUxrBiE+zXH66PhTBcmGFdhckuyngelC1DYSs9HrfJnzlc48ACeK V1MAPpjyS7ikzYGe0lLjic1ptAd1GvaEQhAtirzYHJ9ethDH6ur9VpMMKtEe/jeO1ELK XcVVwMFlB63AWxSLkGJegGqynw4Ki+lW1f0w0WiAEzhNXgkdm4njoxo3LCZQC7Hd+nQA eQ9Mx/poOOTUWjR4o+5qYBtoXFWFG5uTqfrXXG+vxq5Jy2hsJbLyUUur44DJxcBh5O2B WLDA== X-Forwarded-Encrypted: i=1; AJvYcCU5VKmLyQXJ8nVLvuC0YoGtOV6OpYl6UoETidL74+5S/SnjI/hF7Q12WHJsXxGC6DXQvJ+YFoo=@vger.kernel.org X-Gm-Message-State: AOJu0YwsUqctkIX5VnejbYX/+PD4IaX4kCO+CENxfvI4chWs5b3cH23/ l9uM0Tu86YdnMV21qPOu1oX2gGJUvC0tQmOuOQOezKdaWr5c3U68ddvALZJbE8eFqjA= X-Gm-Gg: ASbGnctWaub+kT48mDOkNYNuMl1Q0KKUkPs2GKwsj7bagLuYJHPz+Oz3FiKMGk/4KU2 POUFSFJHoZo5j0zVVYO6ZJm1nPIIoQ3yuzy0kXNERBAE718ckjxTq75Uu0Sz+8G8NMZ1ov6ujkO zkH2+H2FeuLGZHnIlfBk592U+/jakG/Ca7tN5wuwYMjIbwc5EFYvIAeshI9wIkKrOi7T/OSbZou kfRHGYPjpNDscyQYGIX9jG3vgJT6B2btb5zccFXFrjkVulbRVGhz+wkVxwvyhp8J4Cn0k3UNlIB JxUzAJMtWLCbuCMiYRu9IVQTRr6Yg1/9LrWahurV/mgsx/HzqMRXAiojgcV3LJsKTRiOzUq4vy8 FRpmyeGwz9E1ugOb45bEyXfJKu92uy/UT5VgGcqHF81UGEeHjoKWACA== X-Google-Smtp-Source: AGHT+IHta3Li5X7p3tARLTwnX8shVwR39qDFoRnhPiY5/C8uOkis2kRSCCn/31skW47G6N/ubp5QbA== X-Received: by 2002:a5d:588b:0:b0:3ee:1368:a8e9 with SMTP id ffacd0b85a97d-4266e7befe4mr16005800f8f.17.1760435194566; Tue, 14 Oct 2025 02:46:34 -0700 (PDT) Received: from hackbox.lan ([86.121.7.169]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-426ce5e8b31sm22866442f8f.54.2025.10.14.02.46.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Oct 2025 02:46:30 -0700 (PDT) From: Abel Vesa Date: Tue, 14 Oct 2025 12:46:04 +0300 Subject: [PATCH RESEND v3 2/3] phy: qcom: edp: Make the number of clocks flexible Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20251014-phy-qcom-edp-add-missing-refclk-v3-2-078be041d06f@linaro.org> References: <20251014-phy-qcom-edp-add-missing-refclk-v3-0-078be041d06f@linaro.org> In-Reply-To: <20251014-phy-qcom-edp-add-missing-refclk-v3-0-078be041d06f@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Dmitry Baryshkov , Konrad Dybcio , Sibi Sankar , Rajendra Nayak Cc: Krzysztof Kozlowski , Neil Armstrong , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Abel Vesa , stable@vger.kernel.org X-Mailer: b4 0.15-dev-dedf8 X-Developer-Signature: v=1; a=openpgp-sha256; l=2533; i=abel.vesa@linaro.org; h=from:subject:message-id; bh=Zz2R5WmG71VGhvfhWPgwTOijPEaexpycDrO5L76SRq4=; b=owEBbQKS/ZANAwAKARtfRMkAlRVWAcsmYgBo7hvmyWGvBIBA0KnfwUuTkQ5O0N0SRXHZ6M32u nJXVV82Xw6JAjMEAAEKAB0WIQRO8+4RTnqPKsqn0bgbX0TJAJUVVgUCaO4b5gAKCRAbX0TJAJUV VkUYD/9DaysPmn6S1AiyoZDFnE8K6Uq7dCgppMiJv/5PDo08uGa+LB9OXUIhAa5VwHmc+pkqnkE Fcs1rasiDm6daGLMXF3XC+wPXg+fo1JG4IctnzOytQADR6S4SwMvAlghYl4AZus2Xc/NVQis1FM Q1LpvniFsJgNxi+x4V1t8eBdIkMOy/AMDpjx5YQYGDIaZ2rgBY9pLop3DxTHtGrx9Mgzi5vYxq9 RpHH5ng32pUTq0HEYjgutCJoodn1guq6DbcKbs6H6aHyHQutpKdcE7JwzF3k0uArkjptOnJoWy7 RwF0zXo+2UafhKxZhyEZxfYg35HyngzCmsWpxRP/fE2lmThXkDXL+8v0c3JmAsaG2PXNyn6JfNI OhaX4MJ/jzdqM1u4KgkWm8/v/f6x/q+ztig+BSoYQGCu8ByCWXAm9sO4wq7GS0YIVgqXdck7B5d 41ziXNZoJb9zvesAj8MapR6Vszx9hn5Cyo62oM6+H3nH24KwCtmZY9h3WwZ/fPTGNV2VskzoeNp jvy8NLxN6ylWBbnU46PFIa0iB11iEPhGSfsQwWclkBk8Avm6X1NZdIUjK7IY28y0KVH3Y4lOdBu ioGUW6qPbhDa/D3bfxiz54FAGMLXRSUz0BDRVhUHQL4iI3g6CrHIWa0GZbh+NmLm5OhIJ8DEZbn 4mf3n6OXXA5iSCQ== X-Developer-Key: i=abel.vesa@linaro.org; a=openpgp; fpr=6AFF162D57F4223A8770EF5AF7BF214136F41FAE X-DKIM: signer='linaro.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [139.178.88.99 listed in list.dnswl.org] 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linaro.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: -18 On X Elite, the DP PHY needs another clock called ref, while all other platforms do not. The current X Elite devices supported upstream work fine without this clock, because the boot firmware leaves this clock enabled. But we should not rely on that. Also, even though this change breaks the ABI, it is needed in order to make the driver disables this clock along with the other ones, for a proper bring-down of the entire PHY. So in order to handle these clocks on different platforms, make the driver get all the clocks regardless of how many there are provided. Cc: stable@vger.kernel.org # v6.10 Fixes: db83c107dc29 ("phy: qcom: edp: Add v6 specific ops and X1E80100 platform support") Signed-off-by: Abel Vesa --- drivers/phy/qualcomm/phy-qcom-edp.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-edp.c b/drivers/phy/qualcomm/phy-qcom-edp.c index f1b51018683d51df064f60440864c6031638670c..ca9bb9d70e29e1a132bd499fb9f74b5837acf45b 100644 --- a/drivers/phy/qualcomm/phy-qcom-edp.c +++ b/drivers/phy/qualcomm/phy-qcom-edp.c @@ -103,7 +103,9 @@ struct qcom_edp { struct phy_configure_opts_dp dp_opts; - struct clk_bulk_data clks[2]; + struct clk_bulk_data *clks; + int num_clks; + struct regulator_bulk_data supplies[2]; bool is_edp; @@ -218,7 +220,7 @@ static int qcom_edp_phy_init(struct phy *phy) if (ret) return ret; - ret = clk_bulk_prepare_enable(ARRAY_SIZE(edp->clks), edp->clks); + ret = clk_bulk_prepare_enable(edp->num_clks, edp->clks); if (ret) goto out_disable_supplies; @@ -885,7 +887,7 @@ static int qcom_edp_phy_exit(struct phy *phy) { struct qcom_edp *edp = phy_get_drvdata(phy); - clk_bulk_disable_unprepare(ARRAY_SIZE(edp->clks), edp->clks); + clk_bulk_disable_unprepare(edp->num_clks, edp->clks); regulator_bulk_disable(ARRAY_SIZE(edp->supplies), edp->supplies); return 0; @@ -1092,11 +1094,9 @@ static int qcom_edp_phy_probe(struct platform_device *pdev) if (IS_ERR(edp->pll)) return PTR_ERR(edp->pll); - edp->clks[0].id = "aux"; - edp->clks[1].id = "cfg_ahb"; - ret = devm_clk_bulk_get(dev, ARRAY_SIZE(edp->clks), edp->clks); - if (ret) - return ret; + edp->num_clks = devm_clk_bulk_get_all(dev, &edp->clks); + if (edp->num_clks < 0) + return dev_err_probe(dev, edp->num_clks, "failed to parse clocks\n"); edp->supplies[0].supply = "vdda-phy"; edp->supplies[1].supply = "vdda-pll"; -- 2.48.1 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id QLYGIUYc7mj+EAEAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 09:47:50 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 09:47:50 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8bdG-00000000OIx-0eJ1 for hi@josie.lol; Tue, 14 Oct 2025 09:47:50 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 1DAA14FBFE7 for ; Tue, 14 Oct 2025 09:47:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 329DA2FCC01; Tue, 14 Oct 2025 09:46:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="PhSEh40R" X-Original-To: stable@vger.kernel.org Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B55BF2ECE8A for ; Tue, 14 Oct 2025 09:46:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760435193; cv=none; b=WP1Lw9MPmpVOs6Hyv7IOGTEYZN+SvDbVd3UA6eQy04A3tNEDba288+nrWBWoIPCdAH9fKNxGaiwf5hypiiylMIf+8q3waNnnQgffiSqUQE08h/qHffv9D5mmE9ilsRCMh98WC/UUM5dN6GI9zNlVh3cTbKjA8kevd36ZfrLyWkE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760435193; c=relaxed/simple; bh=OaVD3kgCGNuvepXOAnIi/Jmw2IJiuqOadOslMs/qPqM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pKbjWlQfMuNqUX7f820jCA931huUYa3U7V5nkClgjqjBY3844Gqa4DTx9ApefnlOjebyOyA8pZKwzKSHJc+OPmu2hOZkJ23+0u6qWg4416/FgQQQLGEF6jgPU2buXT1EmBVVkxo5tGMyib5D/6lkqvCi9bXW5BEqTAwJ/tmtvyA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=PhSEh40R; arc=none smtp.client-ip=209.85.221.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-41174604d88so2306403f8f.2 for ; Tue, 14 Oct 2025 02:46:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1760435188; x=1761039988; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=KnhRFLfQaO8pIowD5rNcrWOdNtst07qFW/F+KRDikEA=; b=PhSEh40RHS42/Or92+1Lixn5jmDoWeojAQi8HznP9zXzsZGPilB0jJhhDqSiVvWWj2 wB0kxmIzCCQaiBFMuwVI0FvX/vmfeL3WEgrYxs5cp8BOtdFBN9LNjButaAhJNo1NfQz5 NmvPBCm+V0mZX2pViE8FHWKzmPEekMnrCVYCvYSKMagSRTkmMy5Q2DljtyDj+7Qe72iW MmmSwthpZ8ccKnBuL0qbFlVLHqPgz5qoXxsxq15uQxXqhzkc399z3wOzQCeRdDgA9OxL bQ1WC1ZzZLWnaRl8AvHul/byWFfh1c6eDtQ7zCyItKYeRSSaMHQwMcvCE21GBA5Ufy7O LFeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760435188; x=1761039988; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KnhRFLfQaO8pIowD5rNcrWOdNtst07qFW/F+KRDikEA=; b=dhnIuUTCQEB4s1GmvMXJ45oIKmr4zJHyOdNI4UksRmVH2GCgB8ZpH5apCvr9BkEqMc v11VFxRZTri91tj57r11IToPQg6FTW3gfdyqaWB2TJsoR/VUx17Km3aOIyMRCD3WNJlM b5PPOl7A7WnKIDxPcwx1nv8BP+T1niQFrqyyLTSRaLw2w4yLwvNiCrGqTf+CoCFgf+EM Qqe74+W0VT1CH6POlwD6kN/wVVTVYk3Tzftpyol5FwtSFnbmqJrni8ED1Gt8gBRNWkit EZQwJ9gQudBXD1t9phlP/Qdcd4nPU7Zh/UDsCCYYv8+BBwAsmpUdzaHhn+CqDh4bg08y odSg== X-Forwarded-Encrypted: i=1; AJvYcCVqGamGkXu+X3Eqj8YeV0T6DnsMK09EK9+y+eLNXEMqrJpOA0i76uojOAWFTRoSBLo0tcig86Q=@vger.kernel.org X-Gm-Message-State: AOJu0Yy+WCBDek3xfMdkVnDTr4+OGN91sEBz6NggPtT7vZoopeW2r55c 0waO1QqkTkYd/Tf2anfQHdGjM/A9J5FYIuucsb156i1craoVYXJlQfeGjJP3I2txgE8= X-Gm-Gg: ASbGncv/A7u+BZy5K6UFXE7wrfQorc9mWMpFj8h7LCRP7zUN51gDpa6CPJv2bM2XshU SmwYnApWyaqPj37Wqyjwl4m5pNAN4LTH1SzQlmPbjLKlLfnGjL+e55Ln46OiP6HFhlDdQ5CnSU3 QUPftVCs9C4qxDiwpfZU407poLsGg0Dwf8CatCDCrMHyXxc5NJC4y36Vp9D93y0Nh9ZxbVVnUT7 wfbvQdwZxY5+n5GKGZ7I+GLnh2RAANKyuVsHZKAn02vWZSGiwPiecp4APqKWniZb0AJE9we0REH MeVb4Qzd1ihUfptRWCwLGcB2gLVK6iZCC4ogmzbmShJsMAxKzFdqQ7NY+n49KI2mtf6FIKqrQ/U a+WhDfalqkFuPvVPZROnbDYxztiM/+Th7zFDy+oXpVUo= X-Google-Smtp-Source: AGHT+IFXhmtv8zqtFThQ4wP4GXOnS4SW/hYu7K5sk0wtbU92NOb2q+yfXz84YaQJJ4YvyUnKm5VinA== X-Received: by 2002:a05:6000:40da:b0:3ee:15c6:9a55 with SMTP id ffacd0b85a97d-4266e7e00b8mr13699381f8f.34.1760435188415; Tue, 14 Oct 2025 02:46:28 -0700 (PDT) Received: from hackbox.lan ([86.121.7.169]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-426ce5e8b31sm22866442f8f.54.2025.10.14.02.46.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Oct 2025 02:46:25 -0700 (PDT) From: Abel Vesa Date: Tue, 14 Oct 2025 12:46:03 +0300 Subject: [PATCH RESEND v3 1/3] dt-bindings: phy: qcom-edp: Add missing clock for X Elite Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20251014-phy-qcom-edp-add-missing-refclk-v3-1-078be041d06f@linaro.org> References: <20251014-phy-qcom-edp-add-missing-refclk-v3-0-078be041d06f@linaro.org> In-Reply-To: <20251014-phy-qcom-edp-add-missing-refclk-v3-0-078be041d06f@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Dmitry Baryshkov , Konrad Dybcio , Sibi Sankar , Rajendra Nayak Cc: Krzysztof Kozlowski , Neil Armstrong , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Abel Vesa , stable@vger.kernel.org X-Mailer: b4 0.15-dev-dedf8 X-Developer-Signature: v=1; a=openpgp-sha256; l=2071; i=abel.vesa@linaro.org; h=from:subject:message-id; bh=OaVD3kgCGNuvepXOAnIi/Jmw2IJiuqOadOslMs/qPqM=; b=owEBbQKS/ZANAwAKARtfRMkAlRVWAcsmYgBo7hvjUncltiOMHWO3SuDDxpda2OpYU2rLNm6C7 uQpVNVVCjKJAjMEAAEKAB0WIQRO8+4RTnqPKsqn0bgbX0TJAJUVVgUCaO4b4wAKCRAbX0TJAJUV Vk96D/4w36skQobp628M9KrofHekiWoDIJ3lHS3GsMM2ZGVAg0RbtIH4G+JPIFjFQSL5mfBssp2 I/DDwKegs3A8WsG2e1cTvD+2I7KDzoVFdeI6t0C0VpXkWzfXjqjdC7CFyAb5TeWgIFAJSyR6JY0 hRXgOFWOHetXfZlKd8raA21/+EGY1nd2D2KMI7rmTahpy5cTzoVPJUSf4hk67w+0orv6WEv0PBH RlKfyQiQ3CBKvGYqqe9DB5VrK7RxDDKn6/GxL2U1pR0SLCXhJJt4/Bcj123zYRt2jWTSPFiPsPh TlTVBnPBfQ4DUmidUafFXLDsg/ykx/txAxTef0OFwzGAkhksy0icxt1E9nX++LvTJuwo+BW9AF/ 0qckAxKWfFl+UnMBqs22oCpEWXQbRvuRuQ6mweO/1p1N7X592GMY1ybd7kvcatW467+LNnXaQym gnxxlJc0JNKNq0RpcEwpccV16S4MCC2XPtnnk48qXU38JaYl2ArAL0pNscuiV00SQEUtJO9OTAl 1reMU7ez1xyomjSLc476wrlXd7f1MnxpZ4zrg4ykRWgVHM05jQ9il+B7Oy5inWz66Xo1bjmUF81 5+TJb+lPkgmnLbtfulUc1GOY5mdni5JIPpIssrBWxB2BaIMP2XwToyWBrs9OWQWnKubzbQ/kIky mMFV+QUqAhamXQw== X-Developer-Key: i=abel.vesa@linaro.org; a=openpgp; fpr=6AFF162D57F4223A8770EF5AF7BF214136F41FAE X-DKIM: signer='linaro.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linaro.org] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On X Elite platform, the eDP PHY uses one more clock called ref. The current X Elite devices supported upstream work fine without this clock, because the boot firmware leaves this clock enabled. But we should not rely on that. Also, even though this change breaks the ABI, it is needed in order to make the driver disables this clock along with the other ones, for a proper bring-down of the entire PHY. So attach the this ref clock to the PHY. Cc: stable@vger.kernel.org # v6.10 Fixes: 5d5607861350 ("dt-bindings: phy: qcom-edp: Add X1E80100 PHY compatibles") Reviewed-by: Krzysztof Kozlowski Signed-off-by: Abel Vesa --- .../devicetree/bindings/phy/qcom,edp-phy.yaml | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/phy/qcom,edp-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,edp-phy.yaml index eb97181cbb9579893b4ee26a39c3559ad87b2fba..bfc4d75f50ff9e31981fe602478f28320545e52b 100644 --- a/Documentation/devicetree/bindings/phy/qcom,edp-phy.yaml +++ b/Documentation/devicetree/bindings/phy/qcom,edp-phy.yaml @@ -37,12 +37,15 @@ properties: - description: PLL register block clocks: - maxItems: 2 + minItems: 2 + maxItems: 3 clock-names: + minItems: 2 items: - const: aux - const: cfg_ahb + - const: ref "#clock-cells": const: 1 @@ -64,6 +67,29 @@ required: - "#clock-cells" - "#phy-cells" +allOf: + - if: + properties: + compatible: + enum: + - qcom,x1e80100-dp-phy + then: + properties: + clocks: + minItems: 3 + maxItems: 3 + clock-names: + minItems: 3 + maxItems: 3 + else: + properties: + clocks: + minItems: 2 + maxItems: 2 + clock-names: + minItems: 2 + maxItems: 2 + additionalProperties: false examples: -- 2.48.1 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id mJctKroc7mgjrj8AYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 09:49:46 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 09:49:46 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8bf8-00000000T3I-1WJ0 for hi@josie.lol; Tue, 14 Oct 2025 09:49:46 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id AA972541131 for ; Tue, 14 Oct 2025 09:47:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1E5B42F533E; Tue, 14 Oct 2025 09:46:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Sdz6dm7x" X-Original-To: stable@vger.kernel.org Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFCB82ECD34 for ; Tue, 14 Oct 2025 09:46:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760435187; cv=none; b=jpSDDeCcZdL1Tst8xI+xk07b3szF+WvTnzcWe0iwiwm1Q2AHzd9ecRcFn+fakJpvZKFaRLH92ICCa40OhBWfgsd0bhaHilF86VPOXD027veQHUNjyHc8HWeR+PvhzHVnxlKJF3mo6cvSMr3EqeJIXKWzAkue8TSI+P7/t/9Sj04= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760435187; c=relaxed/simple; bh=l3LysOIyApMjrPfw785wmo0UxKg51Ii7YvKFAglf7l4=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=WkzYYYhn4BNKoXsPkqfrrrb9PKxDugdD8rTZ9HFd5AYy9lHY767HKjfl2WhB0neQeeC8ee/Qqx7ee3cZtwiIYooPJc2wlSFaFv55DiQcwHeHK71DVhPHL0zFsifvkvemMyZw3uBK9MulwM5VcmENq4QC04pdGmwJo+iGpMwRVGA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Sdz6dm7x; arc=none smtp.client-ip=209.85.221.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-42557c5cedcso2742089f8f.0 for ; Tue, 14 Oct 2025 02:46:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1760435183; x=1761039983; darn=vger.kernel.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=2bKZTYq6/6Otgm4/JoAPAscRI3Nhvh8qLkW+Q3h459I=; b=Sdz6dm7xsfA7VZo9QkVy16mjLcHWRBxWOLN4j8B83SuCgECZjSHfjh4pXeB0P3kR1+ wSHW9Zfi1jGqEe89w+iDWNNI7/JuLkSor4sbg+KYAWw0qtwhIvgjUQQHiCBlNJGxJ8Ib Rc+iR+lLdzp5XoOQBA7LmO4MF+RMDHqr36OVR1Z/1QQ5VynxNhAUPnVHQ/B7Kbo7m2qv mplIdc4NYGCpg2SzKcTscWZMr4GcQVfFNNAsIrm5eQJZvAuRbAxZrqBY1H6WF0IA+PfI j3vr6BWExjVnJn79Y4/W0Rru+lCni5FcAj+QYDazYekcN/fTJHDtHkbtJGCzAfU5PW8S U/1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760435183; x=1761039983; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2bKZTYq6/6Otgm4/JoAPAscRI3Nhvh8qLkW+Q3h459I=; b=IGnAX9Joef86Y5ZofQZXYNLeTMCpV8swJrtahZY6Rgat5oslFmmIspwxKA+v98dXkh MxDJ9xzZ0zrXdXyFfLhUHiyLDZ6G+XJ2bfwtEJDMeVufC2lCcMWR4GXYsouPDmWvq86+ OUlNvWfmqUGlNWqduiX8FhBiFwIirRC2RukzVBFGMj5ODroTdSenLoLgO2VcPXo0VTv9 ZUR1Gc3OlLyN9OEbfInSnJo5DQZpaa5pL9Rb1CWy3yv4SMdc1/CpnQjKSGz6HOud00KP SwnXLE0KRlnvpPMCpFQrG8z5A9sg5q+L22BFWdLhRb9WyE/nUJ57sHJQXUrpvNMvXMTP CSVA== X-Forwarded-Encrypted: i=1; AJvYcCWRamXCxseaL1A8CTPa53pVViStN7OCKEc8SIN7Bamrm6vwLvJ2r/pYYpgn61OpkQ4heHdTDsQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzzSZwt7iDcg2zKbsZ2DlC49Lc7ww5p35mpNXOAR0cADS/ZUZB+ 97q0Gu7xPFENmFKbXx+gbou6S0AmWNaTswYVx9rv/aJJo7jNVWGFApxm/DTyHByCaV8= X-Gm-Gg: ASbGncv6fdsCUjBSAjgpVGgm/9kSLr0jMU9MEbRR44o/buTUPGI/qyvaM1ie01YlbOo ymATRf/jHhjda59/n/58/5bVgq+KaG0EDzo3xUGAJag6kQp/vmE8avz/S+k4LL4XoV0p19HoDFE J+XBxUgvfLV0gEwb8mh7i9BjAo9jPalYaulza4JmNU/JPnNk0mrMUm27AIB0+S7cR9psGZ+Cm3q ODpTYVTMJWoXJF1DxatwKRD0oofvLM/jMHaAj9QApqLR2xfigzxz/VtEOcCugCs8qdQNzef4J5I 9BV8x4wtBdFDQr8gEl7ibB+3cgWWo0zuB44xsQWLoFTjiHDf9UOm6XO49KSDdm4YZ9rXjTABf5r wF0qzYgV0MCPWyRLiuC4/naoMpXfqwUiDKRRukfZIDCJ5Pd9gXUIOcA== X-Google-Smtp-Source: AGHT+IEUB3DwM5KbLo0YAJy95OK5FzaMYTEWXQtizciZwE/s3oqnbKLTxn0r/kkXbHky5tXVsGFBvg== X-Received: by 2002:a05:6000:2305:b0:3ea:c360:ff88 with SMTP id ffacd0b85a97d-4266e7dffe5mr15539748f8f.31.1760435183185; Tue, 14 Oct 2025 02:46:23 -0700 (PDT) Received: from hackbox.lan ([86.121.7.169]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-426ce5e8b31sm22866442f8f.54.2025.10.14.02.46.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Oct 2025 02:46:20 -0700 (PDT) From: Abel Vesa Subject: [PATCH RESEND v3 0/3] phy: qcom: edp: Add missing ref clock to x1e80100 Date: Tue, 14 Oct 2025 12:46:02 +0300 Message-Id: <20251014-phy-qcom-edp-add-missing-refclk-v3-0-078be041d06f@linaro.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIANob7mgC/42NPQvCMBRF/4pk9kmaUhudHOzqoKM4pPloH7ZJT aRYSv+7IYs4KQ8e3HvhnJkE7VEHsl/NxOsRAzobQ75eEdkK22hAFTNhlBW0zCkM7QQP6XrQagC hFPQYAtoGvDayu0Mhas7iGa5LEilD7PGVDFdyri7V6UhusW8xPJ2fknjM0vq3Y8yAwtaUXBgtV C3NoUMrvNs43yT4yD7AHc1/A1kEKs5lVlOp4v8CLsvyBsfdUy0oAQAA X-Change-ID: 20250730-phy-qcom-edp-add-missing-refclk-5ab82828f8e7 To: Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Dmitry Baryshkov , Konrad Dybcio , Sibi Sankar , Rajendra Nayak Cc: Krzysztof Kozlowski , Neil Armstrong , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Abel Vesa , stable@vger.kernel.org X-Mailer: b4 0.15-dev-dedf8 X-Developer-Signature: v=1; a=openpgp-sha256; l=2061; i=abel.vesa@linaro.org; h=from:subject:message-id; bh=l3LysOIyApMjrPfw785wmo0UxKg51Ii7YvKFAglf7l4=; b=owEBbQKS/ZANAwAKARtfRMkAlRVWAcsmYgBo7hvgVAHgN7NhN1/gnFmV/M7oRWvD9UaYEhDcp EFbt/WOLzOJAjMEAAEKAB0WIQRO8+4RTnqPKsqn0bgbX0TJAJUVVgUCaO4b4AAKCRAbX0TJAJUV VjPUD/4vUoPpHoZQWjDPWDIax0TPyCIZXxnvSmDbXKi4MhCqrcHcqwDOearqPMQ8sxSM7QmlQ2b KGS0+yeAvLVpGGIfMzL8PbjdspuFBqqa7HRvq26iaynnnb3XzBwtY82XMW05SAVh1mA8c3frW+v TyrcvmlnC9nUqZlQPiaheoyJ3+KPOKIL/IHSBSonTKoWTEhFTIzQT08A+MlJKAEatGZ8Rw1j6O5 bT0eISB85t7O7wRCXnUsvw+3dVF5dCQA/EW7KR4XnYcAAikYMTTi2F+QM7hPnP36UWs44pSaq/u CiLbgozuozyDaM8SZwSEyiPC/mbRyIuOpWYeyeAj7zE9b9QE4wtFZYqUiXLFpkcTu+vTjuHKx/J 9Cx8cSdYudTX3X2dT3KQgvqPuM1+mFkpeYnibSDgQqLYs4cC2/NyoqabG5B0Ba60cWZjoaWLw+Q qOnjtM5NFKVKHHsFOP9hUOYgBI7CkHoQRG47iXJ50lmvCUqR31nrSRkYGPOwAZ5AqsFUlDZG4K6 pWnso6ZqhODJmEFSympcsTLFII5/A+1PMhzlDp4v++C2h/kbeks3HH0UfGyTSPcWQ0goKvw2Dpa B8lZPdjzvzgIKMyx8lnE6jsr7wqd60+pO+J9TJpzPASUa52RGX7eDdrtisyyrZ8hW5qDG7+2EFB CTJZTSy9WL91a8w== X-Developer-Key: i=abel.vesa@linaro.org; a=openpgp; fpr=6AFF162D57F4223A8770EF5AF7BF214136F41FAE X-DKIM: signer='linaro.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linaro.org] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: -18 According to documentation, the DP PHY on x1e80100 has another clock called ref. The current X Elite devices supported upstream work fine without this clock, because the boot firmware leaves this clock enabled. But we should not rely on that. Also, when it comes to power management, this clock needs to be also disabled on suspend. So even though this change breaks the ABI, it is needed in order to make we disable this clock on runtime PM, when that is going to be enabled in the driver. So rework the driver to allow different number of clocks, fix the dt-bindings schema and add the clock to the DT node as well. Signed-off-by: Abel Vesa --- Changes in v3 (resend) - picked-up Krzysztof's R-b tag for bindings patch Changes in v3: - Use dev_err_probe() on clocks parsing failure. - Explain why the ABI break is necessary. - Drop the extra 'clk' suffix from the clock name. So ref instead of refclk. - Link to v2: https://lore.kernel.org/r/20250903-phy-qcom-edp-add-missing-refclk-v2-0-d88c1b0cdc1b@linaro.org Changes in v2: - Fix schema by adding the minItems, as suggested by Krzysztof. - Use devm_clk_bulk_get_all, as suggested by Konrad. - Rephrase the commit messages to reflect the flexible number of clocks. - Link to v1: https://lore.kernel.org/r/20250730-phy-qcom-edp-add-missing-refclk-v1-0-6f78afeadbcf@linaro.org --- Abel Vesa (3): dt-bindings: phy: qcom-edp: Add missing clock for X Elite phy: qcom: edp: Make the number of clocks flexible arm64: dts: qcom: Add missing TCSR ref clock to the DP PHYs .../devicetree/bindings/phy/qcom,edp-phy.yaml | 28 +++++++++++++++++++++- arch/arm64/boot/dts/qcom/x1e80100.dtsi | 12 ++++++---- drivers/phy/qualcomm/phy-qcom-edp.c | 16 ++++++------- 3 files changed, 43 insertions(+), 13 deletions(-) --- base-commit: 52ba76324a9d7c39830c850999210a36ef023cde change-id: 20250730-phy-qcom-edp-add-missing-refclk-5ab82828f8e7 Best regards, -- Abel Vesa From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id cP4ABK817mhljQ0AYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 11:36:15 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 11:36:15 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8dKA-00000003wep-2yI8 for hi@josie.lol; Tue, 14 Oct 2025 11:36:15 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1531E3BE1B2 for ; Tue, 14 Oct 2025 11:36:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BA30930BF7B; Tue, 14 Oct 2025 11:35:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="P/3Rfam4" X-Original-To: stable@vger.kernel.org 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 9597330BF6B for ; Tue, 14 Oct 2025 11:35:59 +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=1760441759; cv=none; b=KwikchsPhowj+VE/sxNYYKvmRDATUiCgSdQaksWgcwSyk8pPdqMlNU/Olr31PFMoYgPAb5zjGJ7wq/RJPZoBH1krkejVlF1jHY8c+uhF1pAbhnPDtR82Lq5dIc9AexHzWIwgSR+XyDlityQqwFZbwr6x25Oq+himI2vQmkxyXCk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760441759; c=relaxed/simple; bh=IzwSRK05agVnf7WULlraPY0sAZEHqquQf3TW6XzfySI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ma1ZdyL1eaLBvoS+F2SQMDWA9lRS/tGd5uFccz7eYlXnqR3T7pZXxfpgVLLc7h+bJ29XRy1KF1Pdns6KxzjHLvwZgMPnHnsQAh5gsXDh9ey2A63sA19D5aUFtZroIWKU4Pn53CMVfPLUh2rpdHCI9dAmLVserlyYx5jnZhalf5k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=P/3Rfam4; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EEE9C4CEE7; Tue, 14 Oct 2025 11:35:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760441759; bh=IzwSRK05agVnf7WULlraPY0sAZEHqquQf3TW6XzfySI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P/3Rfam4ykCxRdzvRlITaSDFbqVCT+94xiLUTxlEHq2hybW0VPdseqLWG0eVauqa/ p+hRkk1eddM5ZbptzxcmrJoDmT4HcseTsRNTypWie7EPWQ4vCBH1W3emKT423EhgVs Wt1yD5oS3uCpzsmLsuebU0Ru4L9LbcU2+RQWq5eNijoahuJD5eLw+YPN50/Nr8sfTf Y6DBu6Vpp62PlPdA08tKIPCYH8ZmpmAqbL5WfSyQwjJQiznRMr69trrnvoED9CC0I0 /7MG8QFKUmJTEM42gkh/q4hbra7ircjjeHlA7Km+m4sRQRc7Jb+LPUPx0K1xWNkzhO pe2qB9dYOPL0w== From: Sasha Levin To: stable@vger.kernel.org Cc: Zheng Qixing , Mikulas Patocka , Sasha Levin Subject: [PATCH 5.4.y] dm: fix NULL pointer dereference in __dm_suspend() Date: Tue, 14 Oct 2025 07:35:55 -0400 Message-ID: <20251014113556.4151972-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2025101316-handmade-imaginary-edf0@gregkh> References: <2025101316-handmade-imaginary-edf0@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.2 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.2 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -11 From: Zheng Qixing [ Upstream commit 8d33a030c566e1f105cd5bf27f37940b6367f3be ] There is a race condition between dm device suspend and table load that can lead to null pointer dereference. The issue occurs when suspend is invoked before table load completes: BUG: kernel NULL pointer dereference, address: 0000000000000054 Oops: 0000 [#1] PREEMPT SMP PTI CPU: 6 PID: 6798 Comm: dmsetup Not tainted 6.6.0-g7e52f5f0ca9b #62 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.1-2.fc37 04/01/2014 RIP: 0010:blk_mq_wait_quiesce_done+0x0/0x50 Call Trace: blk_mq_quiesce_queue+0x2c/0x50 dm_stop_queue+0xd/0x20 __dm_suspend+0x130/0x330 dm_suspend+0x11a/0x180 dev_suspend+0x27e/0x560 ctl_ioctl+0x4cf/0x850 dm_ctl_ioctl+0xd/0x20 vfs_ioctl+0x1d/0x50 __se_sys_ioctl+0x9b/0xc0 __x64_sys_ioctl+0x19/0x30 x64_sys_call+0x2c4a/0x4620 do_syscall_64+0x9e/0x1b0 The issue can be triggered as below: T1 T2 dm_suspend table_load __dm_suspend dm_setup_md_queue dm_mq_init_request_queue blk_mq_init_allocated_queue => q->mq_ops = set->ops; (1) dm_stop_queue / dm_wait_for_completion => q->tag_set NULL pointer! (2) => q->tag_set = set; (3) Fix this by checking if a valid table (map) exists before performing request-based suspend and waiting for target I/O. When map is NULL, skip these table-dependent suspend steps. Even when map is NULL, no I/O can reach any target because there is no table loaded; I/O submitted in this state will fail early in the DM layer. Skipping the table-dependent suspend logic in this case is safe and avoids NULL pointer dereferences. Fixes: c4576aed8d85 ("dm: fix request-based dm's use of dm_wait_for_completion") Cc: stable@vger.kernel.org Signed-off-by: Zheng Qixing Signed-off-by: Mikulas Patocka [ omitted DMF_QUEUE_STOPPED flag setting and braces absent in 5.15 ] Signed-off-by: Sasha Levin --- drivers/md/dm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 3d00bb98d702b..be7182adcdd5b 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -2595,7 +2595,7 @@ static int __dm_suspend(struct mapped_device *md, struct dm_table *map, { bool do_lockfs = suspend_flags & DM_SUSPEND_LOCKFS_FLAG; bool noflush = suspend_flags & DM_SUSPEND_NOFLUSH_FLAG; - int r; + int r = 0; lockdep_assert_held(&md->suspend_lock); @@ -2648,7 +2648,7 @@ static int __dm_suspend(struct mapped_device *md, struct dm_table *map, * Stop md->queue before flushing md->wq in case request-based * dm defers requests to md->wq from md->queue. */ - if (dm_request_based(md)) + if (map && dm_request_based(md)) dm_stop_queue(md->queue); flush_workqueue(md->wq); @@ -2658,7 +2658,8 @@ static int __dm_suspend(struct mapped_device *md, struct dm_table *map, * We call dm_wait_for_completion to wait for all existing requests * to finish. */ - r = dm_wait_for_completion(md, task_state); + if (map) + r = dm_wait_for_completion(md, task_state); if (!r) set_bit(dmf_suspended_flag, &md->flags); -- 2.51.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id sEhoA4/C7GgHiwsAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 09:12:47 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 09:12:47 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8Ebm-00000003bVb-2TrG for hi@josie.lol; Mon, 13 Oct 2025 09:12:47 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B1BC21899BBE for ; Mon, 13 Oct 2025 09:13:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 476A82FBE14; Mon, 13 Oct 2025 09:12:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="EUminlK9" X-Original-To: stable@vger.kernel.org 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 232D22FBDE8 for ; Mon, 13 Oct 2025 09:12:29 +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=1760346750; cv=none; b=ADlLqMwWTEFmio+JBZm9efAPm6XugAu8tyORPG8ZdEMYak6GRh1aIM4MSqrYutnatNN5SW4uhxzq9FagVU5IXf2Aq9nl+5Mp2CJf0KuQtsnysKIoa+8/H//wiMch28SNvzlQ4LB6c1R8ZFcaK2moHvY0/QkBH2rqLOhaD2Pb1Xg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760346750; c=relaxed/simple; bh=WyEr3Ad4V5WDw5hB56aBuNTfKHuy16eGkrBgNZUpBE4=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=h4wq4b5mLPpKGGYaqch85y3jSvd89mjJ1AwEW9mS0CKhboP5S8r+qw/kY32b5ETvJJBA/IQvAyLQXhW7FAOtWYxErmFW9ViApbTzAHGAzaIT3VQr0aYnnW3YndB+SmrKg88J86B2TT/jrvVb/ptgSo/U5dSMlNhB3DRk3ivB3k0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=EUminlK9; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 352EDC4CEE7; Mon, 13 Oct 2025 09:12:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760346749; bh=WyEr3Ad4V5WDw5hB56aBuNTfKHuy16eGkrBgNZUpBE4=; h=Subject:To:Cc:From:Date:From; b=EUminlK90OarBHTOVCNXNTLXVG3Tw1bXH3wD6H+q0NFMxz1MqAHm2aMsbfbHGCh1P hzulvBCcRy40jUjptOSfMa4fO1t8htpR8Kc7QzWr+f2HwZhJeZPPrpcCDqhL5pO7g+ qAChCeSXsJlgdb0U97ZIvB03EL375suV2QTbBFcw= Subject: FAILED: patch "[PATCH] dm: fix NULL pointer dereference in __dm_suspend()" failed to apply to 5.4-stable tree To: zhengqixing@huawei.com,mpatocka@redhat.com Cc: From: Date: Mon, 13 Oct 2025 11:12:17 +0200 Message-ID: <2025101316-handmade-imaginary-edf0@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit X-DKIM: signer='linuxfoundation.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linuxfoundation.org] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [147.75.80.249 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -18 The patch below does not apply to the 5.4-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.4.y git checkout FETCH_HEAD git cherry-pick -x 8d33a030c566e1f105cd5bf27f37940b6367f3be # git commit -s git send-email --to '' --in-reply-to '2025101316-handmade-imaginary-edf0@gregkh' --subject-prefix 'PATCH 5.4.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 8d33a030c566e1f105cd5bf27f37940b6367f3be Mon Sep 17 00:00:00 2001 From: Zheng Qixing Date: Tue, 26 Aug 2025 15:42:04 +0800 Subject: [PATCH] dm: fix NULL pointer dereference in __dm_suspend() There is a race condition between dm device suspend and table load that can lead to null pointer dereference. The issue occurs when suspend is invoked before table load completes: BUG: kernel NULL pointer dereference, address: 0000000000000054 Oops: 0000 [#1] PREEMPT SMP PTI CPU: 6 PID: 6798 Comm: dmsetup Not tainted 6.6.0-g7e52f5f0ca9b #62 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.1-2.fc37 04/01/2014 RIP: 0010:blk_mq_wait_quiesce_done+0x0/0x50 Call Trace: blk_mq_quiesce_queue+0x2c/0x50 dm_stop_queue+0xd/0x20 __dm_suspend+0x130/0x330 dm_suspend+0x11a/0x180 dev_suspend+0x27e/0x560 ctl_ioctl+0x4cf/0x850 dm_ctl_ioctl+0xd/0x20 vfs_ioctl+0x1d/0x50 __se_sys_ioctl+0x9b/0xc0 __x64_sys_ioctl+0x19/0x30 x64_sys_call+0x2c4a/0x4620 do_syscall_64+0x9e/0x1b0 The issue can be triggered as below: T1 T2 dm_suspend table_load __dm_suspend dm_setup_md_queue dm_mq_init_request_queue blk_mq_init_allocated_queue => q->mq_ops = set->ops; (1) dm_stop_queue / dm_wait_for_completion => q->tag_set NULL pointer! (2) => q->tag_set = set; (3) Fix this by checking if a valid table (map) exists before performing request-based suspend and waiting for target I/O. When map is NULL, skip these table-dependent suspend steps. Even when map is NULL, no I/O can reach any target because there is no table loaded; I/O submitted in this state will fail early in the DM layer. Skipping the table-dependent suspend logic in this case is safe and avoids NULL pointer dereferences. Fixes: c4576aed8d85 ("dm: fix request-based dm's use of dm_wait_for_completion") Cc: stable@vger.kernel.org Signed-off-by: Zheng Qixing Signed-off-by: Mikulas Patocka diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 7222f20c1a83..66dd5f6ce778 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -2908,7 +2908,7 @@ static int __dm_suspend(struct mapped_device *md, struct dm_table *map, { bool do_lockfs = suspend_flags & DM_SUSPEND_LOCKFS_FLAG; bool noflush = suspend_flags & DM_SUSPEND_NOFLUSH_FLAG; - int r; + int r = 0; lockdep_assert_held(&md->suspend_lock); @@ -2960,7 +2960,7 @@ static int __dm_suspend(struct mapped_device *md, struct dm_table *map, * Stop md->queue before flushing md->wq in case request-based * dm defers requests to md->wq from md->queue. */ - if (dm_request_based(md)) { + if (map && dm_request_based(md)) { dm_stop_queue(md->queue); set_bit(DMF_QUEUE_STOPPED, &md->flags); } @@ -2972,7 +2972,8 @@ static int __dm_suspend(struct mapped_device *md, struct dm_table *map, * We call dm_wait_for_completion to wait for all existing requests * to finish. */ - r = dm_wait_for_completion(md, task_state); + if (map) + r = dm_wait_for_completion(md, task_state); if (!r) set_bit(dmf_suspended_flag, &md->flags); From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id AGVzLPI17mg86QsAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 11:37:22 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 11:37:22 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8dLG-00000003z6e-0dmu for hi@josie.lol; Tue, 14 Oct 2025 11:37:22 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 887E5188F990 for ; Tue, 14 Oct 2025 11:37:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D82B11DFCB; Tue, 14 Oct 2025 11:37:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Sjxn6ts+" X-Original-To: stable@vger.kernel.org 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 B3B4D2FE055 for ; Tue, 14 Oct 2025 11:37:17 +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=1760441837; cv=none; b=Igc0ilZOna5PE7NY14Yk+o+DBB9sNcpD4ml+aW2PeZe2Bi7K7P8TQTrT9Q9GxewW7GPt/3oK7D4hwzVMbCUpHyDOO8Pck11Vf3oOkOb0CxowcVjhAYeTZ9HnK8zHHXIaKexWexUuCPvHLsPfG30sdUYJyDt1tKyuo2J00ekMrhM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760441837; c=relaxed/simple; bh=dVLBljEe6rgwbM8yOlqOIM/ECk5Zs3tMOBm/XxxPLaU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iiQt7dyXXOSWE8HZQPHXtMNXQYmUht+6oBBVYwmU7RwpF68iB8u1CtAOS3NqOKb3BBlg+bvE2mvM+/m8rMFW8a6b8QcpSZhB0snnNS0CzGxQInuaL4w4JejJJxWqY5wmkgjk00T+BpllFz7c1SBxHE6Vc/mP70iTmURg+yM6vr8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Sjxn6ts+; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0FDEC4CEE7; Tue, 14 Oct 2025 11:37:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760441837; bh=dVLBljEe6rgwbM8yOlqOIM/ECk5Zs3tMOBm/XxxPLaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sjxn6ts+6oq3soqHCWzqCFpUXN72vTSoZWLyLEP4UFISrkCAoisJwOJ2LWfIXfzIQ CUJVeVKifgTRAIeWFSA/cLKAoGlcF5FaRGfaRYLMXwVER5XMNIBdC+/tELqiNqOP7p RfalbvJ9XwYrRsRoCMpnt+1ELQ9JS10fZ9Y+AWLdB3SEKqsFV3ZyiLbFar2Ca83pfm EpMLUogpFpnfFJgM/G2AxjGwC0gyTLEeQi2FJ+9iTt4hBVuZl03knJ4/8MwKlOANzd BzNNUzObhsWDw9S79JkItyR9K+ku+3pmhtrKqsIVCR9x+nbwefAYbiyEWdkbb3+Lz8 dAToR6SubxizA== From: Sasha Levin To: stable@vger.kernel.org Cc: Yuan Chen , "Masami Hiramatsu (Google)" , Sasha Levin Subject: [PATCH 5.15.y] tracing: Fix race condition in kprobe initialization causing NULL pointer dereference Date: Tue, 14 Oct 2025 07:37:14 -0400 Message-ID: <20251014113714.4153034-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2025101325-slinging-idealism-2cdf@gregkh> References: <2025101325-slinging-idealism-2cdf@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.2 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.2 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.80.249 listed in list.dnswl.org] -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -11 From: Yuan Chen [ Upstream commit 9cf9aa7b0acfde7545c1a1d912576e9bab28dc6f ] There is a critical race condition in kprobe initialization that can lead to NULL pointer dereference and kernel crash. [1135630.084782] Unable to handle kernel paging request at virtual address 0000710a04630000 ... [1135630.260314] pstate: 404003c9 (nZcv DAIF +PAN -UAO) [1135630.269239] pc : kprobe_perf_func+0x30/0x260 [1135630.277643] lr : kprobe_dispatcher+0x44/0x60 [1135630.286041] sp : ffffaeff4977fa40 [1135630.293441] x29: ffffaeff4977fa40 x28: ffffaf015340e400 [1135630.302837] x27: 0000000000000000 x26: 0000000000000000 [1135630.312257] x25: ffffaf029ed108a8 x24: ffffaf015340e528 [1135630.321705] x23: ffffaeff4977fc50 x22: ffffaeff4977fc50 [1135630.331154] x21: 0000000000000000 x20: ffffaeff4977fc50 [1135630.340586] x19: ffffaf015340e400 x18: 0000000000000000 [1135630.349985] x17: 0000000000000000 x16: 0000000000000000 [1135630.359285] x15: 0000000000000000 x14: 0000000000000000 [1135630.368445] x13: 0000000000000000 x12: 0000000000000000 [1135630.377473] x11: 0000000000000000 x10: 0000000000000000 [1135630.386411] x9 : 0000000000000000 x8 : 0000000000000000 [1135630.395252] x7 : 0000000000000000 x6 : 0000000000000000 [1135630.403963] x5 : 0000000000000000 x4 : 0000000000000000 [1135630.412545] x3 : 0000710a04630000 x2 : 0000000000000006 [1135630.421021] x1 : ffffaeff4977fc50 x0 : 0000710a04630000 [1135630.429410] Call trace: [1135630.434828] kprobe_perf_func+0x30/0x260 [1135630.441661] kprobe_dispatcher+0x44/0x60 [1135630.448396] aggr_pre_handler+0x70/0xc8 [1135630.454959] kprobe_breakpoint_handler+0x140/0x1e0 [1135630.462435] brk_handler+0xbc/0xd8 [1135630.468437] do_debug_exception+0x84/0x138 [1135630.475074] el1_dbg+0x18/0x8c [1135630.480582] security_file_permission+0x0/0xd0 [1135630.487426] vfs_write+0x70/0x1c0 [1135630.493059] ksys_write+0x5c/0xc8 [1135630.498638] __arm64_sys_write+0x24/0x30 [1135630.504821] el0_svc_common+0x78/0x130 [1135630.510838] el0_svc_handler+0x38/0x78 [1135630.516834] el0_svc+0x8/0x1b0 kernel/trace/trace_kprobe.c: 1308 0xffff3df8995039ec : ldr x21, [x24,#120] include/linux/compiler.h: 294 0xffff3df8995039f0 : ldr x1, [x21,x0] kernel/trace/trace_kprobe.c 1308: head = this_cpu_ptr(call->perf_events); 1309: if (hlist_empty(head)) 1310: return 0; crash> struct trace_event_call -o struct trace_event_call { ... [120] struct hlist_head *perf_events; //(call->perf_event) ... } crash> struct trace_event_call ffffaf015340e528 struct trace_event_call { ... perf_events = 0xffff0ad5fa89f088, //this value is correct, but x21 = 0 ... } Race Condition Analysis: The race occurs between kprobe activation and perf_events initialization: CPU0 CPU1 ==== ==== perf_kprobe_init perf_trace_event_init tp_event->perf_events = list;(1) tp_event->class->reg (2)← KPROBE ACTIVE Debug exception triggers ... kprobe_dispatcher kprobe_perf_func (tk->tp.flags & TP_FLAG_PROFILE) head = this_cpu_ptr(call->perf_events)(3) (perf_events is still NULL) Problem: 1. CPU0 executes (1) assigning tp_event->perf_events = list 2. CPU0 executes (2) enabling kprobe functionality via class->reg() 3. CPU1 triggers and reaches kprobe_dispatcher 4. CPU1 checks TP_FLAG_PROFILE - condition passes (step 2 completed) 5. CPU1 calls kprobe_perf_func() and crashes at (3) because call->perf_events is still NULL CPU1 sees that kprobe functionality is enabled but does not see that perf_events has been assigned. Add pairing read and write memory barriers to guarantee that if CPU1 sees that kprobe functionality is enabled, it must also see that perf_events has been assigned. Link: https://lore.kernel.org/all/20251001022025.44626-1-chenyuan_fl@163.com/ Fixes: 50d780560785 ("tracing/kprobes: Add probe handler dispatcher to support perf and ftrace concurrent use") Cc: stable@vger.kernel.org Signed-off-by: Yuan Chen Signed-off-by: Masami Hiramatsu (Google) [ Drop fprobe changes + context ] Signed-off-by: Sasha Levin --- kernel/trace/trace_kprobe.c | 11 +++++++---- kernel/trace/trace_probe.h | 9 +++++++-- kernel/trace/trace_uprobe.c | 12 ++++++++---- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index e062f4efec8d0..03d4ac41d9031 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -1722,14 +1722,15 @@ static int kprobe_register(struct trace_event_call *event, static int kprobe_dispatcher(struct kprobe *kp, struct pt_regs *regs) { struct trace_kprobe *tk = container_of(kp, struct trace_kprobe, rp.kp); + unsigned int flags = trace_probe_load_flag(&tk->tp); int ret = 0; raw_cpu_inc(*tk->nhit); - if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) kprobe_trace_func(tk, regs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret = kprobe_perf_func(tk, regs); #endif return ret; @@ -1741,6 +1742,7 @@ kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) { struct kretprobe *rp = get_kretprobe(ri); struct trace_kprobe *tk; + unsigned int flags; /* * There is a small chance that get_kretprobe(ri) returns NULL when @@ -1753,10 +1755,11 @@ kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) tk = container_of(rp, struct trace_kprobe, rp); raw_cpu_inc(*tk->nhit); - if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tk->tp); + if (flags & TP_FLAG_TRACE) kretprobe_trace_func(tk, ri, regs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) kretprobe_perf_func(tk, ri, regs); #endif return 0; /* We don't tweak kernel, so just return 0 */ diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h index 82e1df8aefcb3..b08aa3946868c 100644 --- a/kernel/trace/trace_probe.h +++ b/kernel/trace/trace_probe.h @@ -258,16 +258,21 @@ struct event_file_link { struct list_head list; }; +static inline unsigned int trace_probe_load_flag(struct trace_probe *tp) +{ + return smp_load_acquire(&tp->event->flags); +} + static inline bool trace_probe_test_flag(struct trace_probe *tp, unsigned int flag) { - return !!(tp->event->flags & flag); + return !!(trace_probe_load_flag(tp) & flag); } static inline void trace_probe_set_flag(struct trace_probe *tp, unsigned int flag) { - tp->event->flags |= flag; + smp_store_release(&tp->event->flags, tp->event->flags | flag); } static inline void trace_probe_clear_flag(struct trace_probe *tp, diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index 322d56661d04a..707c5373476ae 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c @@ -1485,6 +1485,7 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs) struct uprobe_dispatch_data udd; struct uprobe_cpu_buffer *ucb; int dsize, esize; + unsigned int flags; int ret = 0; @@ -1505,11 +1506,12 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs) ucb = uprobe_buffer_get(); store_trace_args(ucb->buf, &tu->tp, regs, esize, dsize); - if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tu->tp); + if (flags & TP_FLAG_TRACE) ret |= uprobe_trace_func(tu, regs, ucb, dsize); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret |= uprobe_perf_func(tu, regs, ucb, dsize); #endif uprobe_buffer_put(ucb); @@ -1523,6 +1525,7 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, struct uprobe_dispatch_data udd; struct uprobe_cpu_buffer *ucb; int dsize, esize; + unsigned int flags; tu = container_of(con, struct trace_uprobe, consumer); @@ -1540,11 +1543,12 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, ucb = uprobe_buffer_get(); store_trace_args(ucb->buf, &tu->tp, regs, esize, dsize); - if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tu->tp); + if (flags & TP_FLAG_TRACE) uretprobe_trace_func(tu, func, regs, ucb, dsize); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) uretprobe_perf_func(tu, func, regs, ucb, dsize); #endif uprobe_buffer_put(ucb); -- 2.51.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id qHIQKsC37GhiOgYAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 08:26:40 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 08:26:40 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8DtA-000000022Wg-0Joo for hi@josie.lol; Mon, 13 Oct 2025 08:26:40 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E6E761898F7B for ; Mon, 13 Oct 2025 08:27:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 31B9F2F39D3; Mon, 13 Oct 2025 08:26:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="K8+r8L58" X-Original-To: stable@vger.kernel.org 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 0E21F2F2902 for ; Mon, 13 Oct 2025 08:26:28 +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=1760343989; cv=none; b=j2tOWlXVYOco9Cl+UbJnfWxjcS5SmwN9Z1Rjnl6ftY+aEh0YBSKEJTkyBBdWgbtxSNLRATPt2GhbD9+pqd56pwAEEzyMOJqSR9YPfUYsfPDcc0y7ONCF4OanBOueijlyetSyDiXJhHqR2Cx9SO/U48HR0Yod4BvH3J6HkWoGeDw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760343989; c=relaxed/simple; bh=GHFJ/nt2qO9u23K4Iq6MW6o6dX+KpZJuaDA5N3uj56s=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=TJTpqH0nzZtgq+xdC2M4t4/R1bTYeLCbDcKfe9CqifCCy+8m2iOHyNns+sr278aq+BKhJPLZt34KX6BcWDucUGI9i7usVIcffeGdImXYxz1G8q5VEG51B8VwCad19IdFjenU2asKdEvihl94nb0ClT0kopTOt0NpbKyfQuR41+o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=K8+r8L58; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44191C4CEE7; Mon, 13 Oct 2025 08:26:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760343988; bh=GHFJ/nt2qO9u23K4Iq6MW6o6dX+KpZJuaDA5N3uj56s=; h=Subject:To:Cc:From:Date:From; b=K8+r8L58qzs0CGrjicp7RJ2MpRXAVAq+oRnBxJ2mRaX2zdOy8jeOSVPj3LyTc16Xd UBeUsZUwzR2pA45JpLNFOyRUyVcZgPW/tXTE+hbyXd4+LQLQVHH+J5nOUlMI6a/HlZ F+JBO7M+YKsnDyQz1Mnw7FDa5ByLZvKkoInNGJFI= Subject: FAILED: patch "[PATCH] tracing: Fix race condition in kprobe initialization causing" failed to apply to 5.15-stable tree To: chenyuan@kylinos.cn,mhiramat@kernel.org Cc: From: Date: Mon, 13 Oct 2025 10:26:25 +0200 Message-ID: <2025101325-slinging-idealism-2cdf@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-DKIM: signer='linuxfoundation.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linuxfoundation.org] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [147.75.80.249 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -18 The patch below does not apply to the 5.15-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y git checkout FETCH_HEAD git cherry-pick -x 9cf9aa7b0acfde7545c1a1d912576e9bab28dc6f # git commit -s git send-email --to '' --in-reply-to '2025101325-slinging-idealism-2cdf@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 9cf9aa7b0acfde7545c1a1d912576e9bab28dc6f Mon Sep 17 00:00:00 2001 From: Yuan Chen Date: Wed, 1 Oct 2025 03:20:25 +0100 Subject: [PATCH] tracing: Fix race condition in kprobe initialization causing NULL pointer dereference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is a critical race condition in kprobe initialization that can lead to NULL pointer dereference and kernel crash. [1135630.084782] Unable to handle kernel paging request at virtual address 0000710a04630000 ... [1135630.260314] pstate: 404003c9 (nZcv DAIF +PAN -UAO) [1135630.269239] pc : kprobe_perf_func+0x30/0x260 [1135630.277643] lr : kprobe_dispatcher+0x44/0x60 [1135630.286041] sp : ffffaeff4977fa40 [1135630.293441] x29: ffffaeff4977fa40 x28: ffffaf015340e400 [1135630.302837] x27: 0000000000000000 x26: 0000000000000000 [1135630.312257] x25: ffffaf029ed108a8 x24: ffffaf015340e528 [1135630.321705] x23: ffffaeff4977fc50 x22: ffffaeff4977fc50 [1135630.331154] x21: 0000000000000000 x20: ffffaeff4977fc50 [1135630.340586] x19: ffffaf015340e400 x18: 0000000000000000 [1135630.349985] x17: 0000000000000000 x16: 0000000000000000 [1135630.359285] x15: 0000000000000000 x14: 0000000000000000 [1135630.368445] x13: 0000000000000000 x12: 0000000000000000 [1135630.377473] x11: 0000000000000000 x10: 0000000000000000 [1135630.386411] x9 : 0000000000000000 x8 : 0000000000000000 [1135630.395252] x7 : 0000000000000000 x6 : 0000000000000000 [1135630.403963] x5 : 0000000000000000 x4 : 0000000000000000 [1135630.412545] x3 : 0000710a04630000 x2 : 0000000000000006 [1135630.421021] x1 : ffffaeff4977fc50 x0 : 0000710a04630000 [1135630.429410] Call trace: [1135630.434828] kprobe_perf_func+0x30/0x260 [1135630.441661] kprobe_dispatcher+0x44/0x60 [1135630.448396] aggr_pre_handler+0x70/0xc8 [1135630.454959] kprobe_breakpoint_handler+0x140/0x1e0 [1135630.462435] brk_handler+0xbc/0xd8 [1135630.468437] do_debug_exception+0x84/0x138 [1135630.475074] el1_dbg+0x18/0x8c [1135630.480582] security_file_permission+0x0/0xd0 [1135630.487426] vfs_write+0x70/0x1c0 [1135630.493059] ksys_write+0x5c/0xc8 [1135630.498638] __arm64_sys_write+0x24/0x30 [1135630.504821] el0_svc_common+0x78/0x130 [1135630.510838] el0_svc_handler+0x38/0x78 [1135630.516834] el0_svc+0x8/0x1b0 kernel/trace/trace_kprobe.c: 1308 0xffff3df8995039ec : ldr x21, [x24,#120] include/linux/compiler.h: 294 0xffff3df8995039f0 : ldr x1, [x21,x0] kernel/trace/trace_kprobe.c 1308: head = this_cpu_ptr(call->perf_events); 1309: if (hlist_empty(head)) 1310: return 0; crash> struct trace_event_call -o struct trace_event_call { ... [120] struct hlist_head *perf_events; //(call->perf_event) ... } crash> struct trace_event_call ffffaf015340e528 struct trace_event_call { ... perf_events = 0xffff0ad5fa89f088, //this value is correct, but x21 = 0 ... } Race Condition Analysis: The race occurs between kprobe activation and perf_events initialization: CPU0 CPU1 ==== ==== perf_kprobe_init perf_trace_event_init tp_event->perf_events = list;(1) tp_event->class->reg (2)← KPROBE ACTIVE Debug exception triggers ... kprobe_dispatcher kprobe_perf_func (tk->tp.flags & TP_FLAG_PROFILE) head = this_cpu_ptr(call->perf_events)(3) (perf_events is still NULL) Problem: 1. CPU0 executes (1) assigning tp_event->perf_events = list 2. CPU0 executes (2) enabling kprobe functionality via class->reg() 3. CPU1 triggers and reaches kprobe_dispatcher 4. CPU1 checks TP_FLAG_PROFILE - condition passes (step 2 completed) 5. CPU1 calls kprobe_perf_func() and crashes at (3) because call->perf_events is still NULL CPU1 sees that kprobe functionality is enabled but does not see that perf_events has been assigned. Add pairing read and write memory barriers to guarantee that if CPU1 sees that kprobe functionality is enabled, it must also see that perf_events has been assigned. Link: https://lore.kernel.org/all/20251001022025.44626-1-chenyuan_fl@163.com/ Fixes: 50d780560785 ("tracing/kprobes: Add probe handler dispatcher to support perf and ftrace concurrent use") Cc: stable@vger.kernel.org Signed-off-by: Yuan Chen Signed-off-by: Masami Hiramatsu (Google) diff --git a/kernel/trace/trace_fprobe.c b/kernel/trace/trace_fprobe.c index b36ade43d4b3..ad9d6347b5fa 100644 --- a/kernel/trace/trace_fprobe.c +++ b/kernel/trace/trace_fprobe.c @@ -522,13 +522,14 @@ static int fentry_dispatcher(struct fprobe *fp, unsigned long entry_ip, void *entry_data) { struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp); + unsigned int flags = trace_probe_load_flag(&tf->tp); int ret = 0; - if (trace_probe_test_flag(&tf->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) fentry_trace_func(tf, entry_ip, fregs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tf->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret = fentry_perf_func(tf, entry_ip, fregs); #endif return ret; @@ -540,11 +541,12 @@ static void fexit_dispatcher(struct fprobe *fp, unsigned long entry_ip, void *entry_data) { struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp); + unsigned int flags = trace_probe_load_flag(&tf->tp); - if (trace_probe_test_flag(&tf->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) fexit_trace_func(tf, entry_ip, ret_ip, fregs, entry_data); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tf->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) fexit_perf_func(tf, entry_ip, ret_ip, fregs, entry_data); #endif } diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index fa60362a3f31..ee8171b19bee 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -1815,14 +1815,15 @@ static int kprobe_register(struct trace_event_call *event, static int kprobe_dispatcher(struct kprobe *kp, struct pt_regs *regs) { struct trace_kprobe *tk = container_of(kp, struct trace_kprobe, rp.kp); + unsigned int flags = trace_probe_load_flag(&tk->tp); int ret = 0; raw_cpu_inc(*tk->nhit); - if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) kprobe_trace_func(tk, regs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret = kprobe_perf_func(tk, regs); #endif return ret; @@ -1834,6 +1835,7 @@ kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) { struct kretprobe *rp = get_kretprobe(ri); struct trace_kprobe *tk; + unsigned int flags; /* * There is a small chance that get_kretprobe(ri) returns NULL when @@ -1846,10 +1848,11 @@ kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) tk = container_of(rp, struct trace_kprobe, rp); raw_cpu_inc(*tk->nhit); - if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tk->tp); + if (flags & TP_FLAG_TRACE) kretprobe_trace_func(tk, ri, regs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) kretprobe_perf_func(tk, ri, regs); #endif return 0; /* We don't tweak kernel, so just return 0 */ diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h index 842383fbc03b..08b5bda24da2 100644 --- a/kernel/trace/trace_probe.h +++ b/kernel/trace/trace_probe.h @@ -271,16 +271,21 @@ struct event_file_link { struct list_head list; }; +static inline unsigned int trace_probe_load_flag(struct trace_probe *tp) +{ + return smp_load_acquire(&tp->event->flags); +} + static inline bool trace_probe_test_flag(struct trace_probe *tp, unsigned int flag) { - return !!(tp->event->flags & flag); + return !!(trace_probe_load_flag(tp) & flag); } static inline void trace_probe_set_flag(struct trace_probe *tp, unsigned int flag) { - tp->event->flags |= flag; + smp_store_release(&tp->event->flags, tp->event->flags | flag); } static inline void trace_probe_clear_flag(struct trace_probe *tp, diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index 8b0bcc0d8f41..430d09c49462 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c @@ -1547,6 +1547,7 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs, struct trace_uprobe *tu; struct uprobe_dispatch_data udd; struct uprobe_cpu_buffer *ucb = NULL; + unsigned int flags; int ret = 0; tu = container_of(con, struct trace_uprobe, consumer); @@ -1561,11 +1562,12 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs, if (WARN_ON_ONCE(!uprobe_cpu_buffer)) return 0; - if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tu->tp); + if (flags & TP_FLAG_TRACE) ret |= uprobe_trace_func(tu, regs, &ucb); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret |= uprobe_perf_func(tu, regs, &ucb); #endif uprobe_buffer_put(ucb); @@ -1579,6 +1581,7 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, struct trace_uprobe *tu; struct uprobe_dispatch_data udd; struct uprobe_cpu_buffer *ucb = NULL; + unsigned int flags; tu = container_of(con, struct trace_uprobe, consumer); @@ -1590,11 +1593,12 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, if (WARN_ON_ONCE(!uprobe_cpu_buffer)) return 0; - if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tu->tp); + if (flags & TP_FLAG_TRACE) uretprobe_trace_func(tu, func, regs, &ucb); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) uretprobe_perf_func(tu, func, regs, &ucb); #endif uprobe_buffer_put(ucb); From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id yMbTM4c27mg+UQ4AYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 11:39:51 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 11:39:51 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8dNf-000000043Q5-22HQ for hi@josie.lol; Tue, 14 Oct 2025 11:39:51 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 87A7D3BE6DD for ; Tue, 14 Oct 2025 11:39:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DAFB2308F34; Tue, 14 Oct 2025 11:39:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QNBGE8X4" X-Original-To: stable@vger.kernel.org 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 B66AE1D435F for ; Tue, 14 Oct 2025 11:39:46 +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=1760441986; cv=none; b=EjtT63V5Cm10YnEIIJehb3MDCxfDxmTeunBZFnjteMr20E+42x7W67NIYr9NlOygA/0AxJtIuaT62HzVsj+fv0a5Mw/7b9IC2kgnVm0n/DXmxFQ6bN+5rZJCpKT4uHT5yVwG5/EcPztc6gSpgXgEWgeN8ohYuQFBwv4jdOmf8aI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760441986; c=relaxed/simple; bh=IsCeuBoV3+N1354qy4A6TG5Hp6mvrO1HU8FqJGS4VaQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kVDIg10woJlSNpgLCPaUhee60nkkAftqJtP+OS/Ne9B6MZmeU0y2ODz9XKxj+Aeejp3uS6UE4ywSHg3U21LsR9Dq04sIPE+Pq0+LIxKkW1tuGOfSVM51uALrsB5RXc0q+AImudZn71hVIQq/VdOscmHm3n16hRhkL3hk/ueflIs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QNBGE8X4; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B546C4CEE7; Tue, 14 Oct 2025 11:39:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760441986; bh=IsCeuBoV3+N1354qy4A6TG5Hp6mvrO1HU8FqJGS4VaQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QNBGE8X4uys1Oy88qa8+FA5xIjc3kFNnTsmNR0tVjuLNDtvY4qcc7BlrmgffVhX// CrxPxePmqO//qaKWLh38ilDjnd5mhi60tSHvgpf09UqXghrlr+gYcLJx4cWRPPAshF RvytGudR/vfQA42IsuRfJ2lv8h+XL146ANDws29Kpmt9UO0gb0E2sHP11Mp0F2gbVY c0HxsTlk+v6HNovdgOVXTfs/nrY4rYWATfn4IoN/pwKoPUDpOCaAIR2wfkrfG/OFgm bapADdD1a9cw6OqRrpzb3mwGlopiKgUS5XBm2IqkZlaSuxfcKlYxJlxFYli64pUNz/ 5o4bYUdF87buw== From: Sasha Levin To: stable@vger.kernel.org Cc: Donet Tom , Chengming Zhou , David Hildenbrand , Aboorva Devarajan , "Ritesh Harjani (IBM)" , Wei Yang , xu xin , Andrew Morton , Sasha Levin Subject: [PATCH 6.17.y] mm/ksm: fix incorrect KSM counter handling in mm_struct during fork Date: Tue, 14 Oct 2025 07:39:43 -0400 Message-ID: <20251014113943.4156526-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2025101357-monorail-juror-352b@gregkh> References: <2025101357-monorail-juror-352b@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.2 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.2 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -11 From: Donet Tom [ Upstream commit 4d6fc29f36341d7795db1d1819b4c15fe9be7b23 ] Patch series "mm/ksm: Fix incorrect accounting of KSM counters during fork", v3. The first patch in this series fixes the incorrect accounting of KSM counters such as ksm_merging_pages, ksm_rmap_items, and the global ksm_zero_pages during fork. The following patch add a selftest to verify the ksm_merging_pages counter was updated correctly during fork. Test Results ============ Without the first patch ----------------------- # [RUN] test_fork_ksm_merging_page_count not ok 10 ksm_merging_page in child: 32 With the first patch -------------------- # [RUN] test_fork_ksm_merging_page_count ok 10 ksm_merging_pages is not inherited after fork This patch (of 2): Currently, the KSM-related counters in `mm_struct`, such as `ksm_merging_pages`, `ksm_rmap_items`, and `ksm_zero_pages`, are inherited by the child process during fork. This results in inconsistent accounting. When a process uses KSM, identical pages are merged and an rmap item is created for each merged page. The `ksm_merging_pages` and `ksm_rmap_items` counters are updated accordingly. However, after a fork, these counters are copied to the child while the corresponding rmap items are not. As a result, when the child later triggers an unmerge, there are no rmap items present in the child, so the counters remain stale, leading to incorrect accounting. A similar issue exists with `ksm_zero_pages`, which maintains both a global counter and a per-process counter. During fork, the per-process counter is inherited by the child, but the global counter is not incremented. Since the child also references zero pages, the global counter should be updated as well. Otherwise, during zero-page unmerge, both the global and per-process counters are decremented, causing the global counter to become inconsistent. To fix this, ksm_merging_pages and ksm_rmap_items are reset to 0 during fork, and the global ksm_zero_pages counter is updated with the per-process ksm_zero_pages value inherited by the child. This ensures that KSM statistics remain accurate and reflect the activity of each process correctly. Link: https://lkml.kernel.org/r/cover.1758648700.git.donettom@linux.ibm.com Link: https://lkml.kernel.org/r/7b9870eb67ccc0d79593940d9dbd4a0b39b5d396.1758648700.git.donettom@linux.ibm.com Fixes: 7609385337a4 ("ksm: count ksm merging pages for each process") Fixes: cb4df4cae4f2 ("ksm: count allocated ksm rmap_items for each process") Fixes: e2942062e01d ("ksm: count all zero pages placed by KSM") Signed-off-by: Donet Tom Reviewed-by: Chengming Zhou Acked-by: David Hildenbrand Cc: Aboorva Devarajan Cc: David Hildenbrand Cc: Donet Tom Cc: "Ritesh Harjani (IBM)" Cc: Wei Yang Cc: xu xin Cc: [6.6+] Signed-off-by: Andrew Morton [ replaced mm_flags_test() calls with test_bit() ] Signed-off-by: Sasha Levin --- include/linux/ksm.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/linux/ksm.h b/include/linux/ksm.h index c17b955e7b0b0..8d61d04542936 100644 --- a/include/linux/ksm.h +++ b/include/linux/ksm.h @@ -56,8 +56,14 @@ static inline long mm_ksm_zero_pages(struct mm_struct *mm) static inline void ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm) { /* Adding mm to ksm is best effort on fork. */ - if (test_bit(MMF_VM_MERGEABLE, &oldmm->flags)) + if (test_bit(MMF_VM_MERGEABLE, &oldmm->flags)) { + long nr_ksm_zero_pages = atomic_long_read(&mm->ksm_zero_pages); + + mm->ksm_merging_pages = 0; + mm->ksm_rmap_items = 0; + atomic_long_add(nr_ksm_zero_pages, &ksm_zero_pages); __ksm_enter(mm); + } } static inline int ksm_execve(struct mm_struct *mm) -- 2.51.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id qEAZHBzD7Ghz3AwAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 09:15:08 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 09:15:08 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8Ee4-00000003hoF-01bk for hi@josie.lol; Mon, 13 Oct 2025 09:15:08 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7A64D1899C12 for ; Mon, 13 Oct 2025 09:15:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0DAA62FC000; Mon, 13 Oct 2025 09:15:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="JferCWR6" X-Original-To: stable@vger.kernel.org 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 DE59D2FBDE8 for ; Mon, 13 Oct 2025 09:15:00 +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=1760346903; cv=none; b=ajuWSKWMRpNpJjRZMNHVSxnu5AjAVHBkGHUA91hcNGcGXB/Oh73rJOMEiAvKVS6C3ROIkdqt0QvL9eYCYQzJa2qfPCOXj6REAVafSth/7x70fAwO1VOcwRibT3RzyJEQpXEd8NiIkCC7JI7PFKGyMMa1AAaE8UR3k07+ECZJKpw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760346903; c=relaxed/simple; bh=xbd9VRvUBv8H4+9LvaCM8QOZsBDpBArv7uAviMAvx7g=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=lec1ojDm/7j+bX9V1Db67QByEiGz/aYAwucpg6p6le31u9qYwGlf9Ps/bTbVBj0G3uewtgUrxzLnQu+OPCQKiyBVpQQVdAdBLed0utswMuR9DiYM93SGupPzjgk0H+1IK23Z22DySLn+E6LRtT2rf0h4cf+9Obt9L4iYg2n7SvU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=JferCWR6; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C2D1C4CEE7; Mon, 13 Oct 2025 09:14:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760346900; bh=xbd9VRvUBv8H4+9LvaCM8QOZsBDpBArv7uAviMAvx7g=; h=Subject:To:Cc:From:Date:From; b=JferCWR6hAbRL8deymFLx5rgnnFiVnGiMl/pep/IUari7yd/9R4YHZkgt/hDhlTGW 9rvnQawVPmYx0yJDTYQygmVGG2dLzaRHYHoclulyDF1OKP0LqyQxcunxig4ruH6jvX U5LQht5My/Oxddvc9M3DPcsr/Vanb55n3gi1gK2Q= Subject: FAILED: patch "[PATCH] mm/ksm: fix incorrect KSM counter handling in mm_struct" failed to apply to 6.17-stable tree To: donettom@linux.ibm.com,aboorvad@linux.ibm.com,akpm@linux-foundation.org,chengming.zhou@linux.dev,david@redhat.com,richard.weiyang@gmail.com,ritesh.list@gmail.com,stable@vger.kernel.org,xu.xin16@zte.com.cn Cc: From: Date: Mon, 13 Oct 2025 11:14:57 +0200 Message-ID: <2025101357-monorail-juror-352b@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit X-DKIM: signer='linuxfoundation.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.80.249 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: 4 The patch below does not apply to the 6.17-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.17.y git checkout FETCH_HEAD git cherry-pick -x 4d6fc29f36341d7795db1d1819b4c15fe9be7b23 # git commit -s git send-email --to '' --in-reply-to '2025101357-monorail-juror-352b@gregkh' --subject-prefix 'PATCH 6.17.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 4d6fc29f36341d7795db1d1819b4c15fe9be7b23 Mon Sep 17 00:00:00 2001 From: Donet Tom Date: Wed, 24 Sep 2025 00:16:59 +0530 Subject: [PATCH] mm/ksm: fix incorrect KSM counter handling in mm_struct during fork Patch series "mm/ksm: Fix incorrect accounting of KSM counters during fork", v3. The first patch in this series fixes the incorrect accounting of KSM counters such as ksm_merging_pages, ksm_rmap_items, and the global ksm_zero_pages during fork. The following patch add a selftest to verify the ksm_merging_pages counter was updated correctly during fork. Test Results ============ Without the first patch ----------------------- # [RUN] test_fork_ksm_merging_page_count not ok 10 ksm_merging_page in child: 32 With the first patch -------------------- # [RUN] test_fork_ksm_merging_page_count ok 10 ksm_merging_pages is not inherited after fork This patch (of 2): Currently, the KSM-related counters in `mm_struct`, such as `ksm_merging_pages`, `ksm_rmap_items`, and `ksm_zero_pages`, are inherited by the child process during fork. This results in inconsistent accounting. When a process uses KSM, identical pages are merged and an rmap item is created for each merged page. The `ksm_merging_pages` and `ksm_rmap_items` counters are updated accordingly. However, after a fork, these counters are copied to the child while the corresponding rmap items are not. As a result, when the child later triggers an unmerge, there are no rmap items present in the child, so the counters remain stale, leading to incorrect accounting. A similar issue exists with `ksm_zero_pages`, which maintains both a global counter and a per-process counter. During fork, the per-process counter is inherited by the child, but the global counter is not incremented. Since the child also references zero pages, the global counter should be updated as well. Otherwise, during zero-page unmerge, both the global and per-process counters are decremented, causing the global counter to become inconsistent. To fix this, ksm_merging_pages and ksm_rmap_items are reset to 0 during fork, and the global ksm_zero_pages counter is updated with the per-process ksm_zero_pages value inherited by the child. This ensures that KSM statistics remain accurate and reflect the activity of each process correctly. Link: https://lkml.kernel.org/r/cover.1758648700.git.donettom@linux.ibm.com Link: https://lkml.kernel.org/r/7b9870eb67ccc0d79593940d9dbd4a0b39b5d396.1758648700.git.donettom@linux.ibm.com Fixes: 7609385337a4 ("ksm: count ksm merging pages for each process") Fixes: cb4df4cae4f2 ("ksm: count allocated ksm rmap_items for each process") Fixes: e2942062e01d ("ksm: count all zero pages placed by KSM") Signed-off-by: Donet Tom Reviewed-by: Chengming Zhou Acked-by: David Hildenbrand Cc: Aboorva Devarajan Cc: David Hildenbrand Cc: Donet Tom Cc: "Ritesh Harjani (IBM)" Cc: Wei Yang Cc: xu xin Cc: [6.6+] Signed-off-by: Andrew Morton diff --git a/include/linux/ksm.h b/include/linux/ksm.h index 22e67ca7cba3..067538fc4d58 100644 --- a/include/linux/ksm.h +++ b/include/linux/ksm.h @@ -56,8 +56,14 @@ static inline long mm_ksm_zero_pages(struct mm_struct *mm) static inline void ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm) { /* Adding mm to ksm is best effort on fork. */ - if (mm_flags_test(MMF_VM_MERGEABLE, oldmm)) + if (mm_flags_test(MMF_VM_MERGEABLE, oldmm)) { + long nr_ksm_zero_pages = atomic_long_read(&mm->ksm_zero_pages); + + mm->ksm_merging_pages = 0; + mm->ksm_rmap_items = 0; + atomic_long_add(nr_ksm_zero_pages, &ksm_zero_pages); __ksm_enter(mm); + } } static inline int ksm_execve(struct mm_struct *mm) From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id LeGPLOY37mjRcQ8AYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 11:45:42 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 11:45:42 +0000 Received: from ams.mirrors.kernel.org ([213.196.21.55]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8dTK-00000004FFJ-05eM for hi@josie.lol; Tue, 14 Oct 2025 11:45:42 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.mirrors.kernel.org (Postfix) with ESMTPS id BA789352371 for ; Tue, 14 Oct 2025 11:45:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F0F6B2C21E1; Tue, 14 Oct 2025 11:45:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UKzIVqWs" X-Original-To: stable@vger.kernel.org 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 C1A2620FABE; Tue, 14 Oct 2025 11:45:36 +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=1760442336; cv=none; b=WxHomSoPg9/bO1EvvC3DGUbmG1ijqnmq7e/cUBybLoZDvFxpV95N+fI9OEc3q9ycV8R2ShZD+DlRVBV/TQdawRCnigU7xAPvjz75uIftTCR9sXRpVKIAl2UaV6L3nHhSpe2ZH1I0KL2Cjw8eRiPKnmk7TE0gB6rb5fN+80RuinY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760442336; c=relaxed/simple; bh=AG55P6B/228OvRnMfdhdS6msUeR9P92IqdLgbli+6Eo=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=iUg2QKdxfrdmJArJY5ACmQDpUJbMV0d6TqflqjLO/d9twHK/GeAvXecS5ZiAuctOJJvCopA4IwJ7MSyGrMfwj9dxNp4Pl/6TDaROKYtesrjvVjyU0lydNrusZk/06oEmCYuyOUG7ii88ZURx9C0dDCBwzMYlOJGj/ygz+vtcZE4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UKzIVqWs; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99854C4CEE7; Tue, 14 Oct 2025 11:45:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760442336; bh=AG55P6B/228OvRnMfdhdS6msUeR9P92IqdLgbli+6Eo=; h=Date:From:Subject:To:Cc:References:In-Reply-To:From; b=UKzIVqWsrx39ae2o3rp+eWJZe6Rrzl1i7/1Qq6iVK+Udp8wGMgUeMWwfTcR9b6fni kWbLiG0PmfIa2tHkj4wLQ/GnsIY3pf5W0W7K+1lNMDQmB2NDq2/QekAyQSu8lmbaBW hzkot8GH3g4LZqqFQW5RUMpNlJxYMfn5B2NPAIq95PrTog6tZcEcfprs0/7ITryi/q HoMAvsgJ+1NdHtXlhfthqi2wwG5JH49o6S948g7kSsGnLuer3C4ZbWTEgT0qrZYNga 9tuHRWhNdr4o3wROyqet1eo8Y/+Ub+QXh5HzBcIzjzRBTkU4fzsfb91sT0P+L1vSX+ i2TGKibHlWFoA== Message-ID: <1ceeca1a-3429-4be0-a0fc-287616638c52@kernel.org> Date: Tue, 14 Oct 2025 13:45:33 +0200 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: hverkuil+cisco@kernel.org Subject: Re: [PATCH v2 2/2] media: az6007: refactor to properly use dvb-usb-v2 To: Jeongjun Park , mchehab@kernel.org, hverkuil@xs4all.nl Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, syzbot+a43c95e5c2c9ed88e966@syzkaller.appspotmail.com References: <20250908150730.24560-1-aha310510@gmail.com> <20250908150730.24560-3-aha310510@gmail.com> Content-Language: en-US, nl In-Reply-To: <20250908150730.24560-3-aha310510@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.2 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.2 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: syzkaller.appspot.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [213.196.21.55 listed in list.dnswl.org] -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -11 Hi Jeongjun Park, On 08/09/2025 17:07, Jeongjun Park wrote: > The az6007 driver has long since transitioned from dvb-usb to dvb-usb-v2, > but its implementation is still a mix of dvb-usb and dvb-usb-v2. > > Addressing the various issues that arise from this requires comprehensive > refactoring to transition to the dvb-usb-v2 implementation. Since I dropped the previous patch, this patch doesn't apply anymore, so I'm dropping it as well. But in any case, this patch really needs to be tested on actual hardware. > > Cc: > Reported-by: syzbot+a43c95e5c2c9ed88e966@syzkaller.appspotmail.com > Closes: https://syzkaller.appspot.com/bug?extid=a43c95e5c2c9ed88e966 What does this syzkaller report have to do with refactoring? I think you're mixing refactoring and fixing a bug. Regards, Hans > Fixes: 786baecfe78f ("[media] dvb-usb: move it to drivers/media/usb/dvb-usb") > Signed-off-by: Jeongjun Park > --- > drivers/media/usb/dvb-usb-v2/az6007.c | 175 +++++++++++++------------- > 1 file changed, 86 insertions(+), 89 deletions(-) > > diff --git a/drivers/media/usb/dvb-usb-v2/az6007.c b/drivers/media/usb/dvb-usb-v2/az6007.c > index 4202042bdb55..5517675fd0b1 100644 > --- a/drivers/media/usb/dvb-usb-v2/az6007.c > +++ b/drivers/media/usb/dvb-usb-v2/az6007.c > @@ -39,10 +39,10 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); > #define AZ6007_READ_IR 0xb4 > > struct az6007_device_state { > - struct mutex mutex; > struct mutex ca_mutex; > struct dvb_ca_en50221 ca; > unsigned warm:1; > + unsigned ci_attached:1; > int (*gate_ctrl) (struct dvb_frontend *, int); > unsigned char data[4096]; > }; > @@ -97,25 +97,30 @@ static struct mt2063_config az6007_mt2063_config = { > .refclock = 36125000, > }; > > -static int __az6007_read(struct usb_device *udev, struct az6007_device_state *st, > +static int __az6007_read(struct dvb_usb_device *d, struct az6007_device_state *st, > u8 req, u16 value, u16 index, u8 *b, int blen) > { > int ret; > > + if (mutex_lock_interruptible(&d->usb_mutex) < 0) > + return -EAGAIN; > + > if (blen > sizeof(st->data)) { > pr_err("az6007: tried to read %d bytes, but I2C max size is %lu bytes\n", > blen, sizeof(st->data)); > - return -EOPNOTSUPP; > + ret = -EOPNOTSUPP; > + goto end_unlock; > } > > - ret = usb_control_msg(udev, > - usb_rcvctrlpipe(udev, 0), > + ret = usb_control_msg(d->udev, > + usb_rcvctrlpipe(d->udev, 0), > req, > USB_TYPE_VENDOR | USB_DIR_IN, > value, index, b, blen, 5000); > if (ret < 0) { > pr_warn("usb read operation failed. (%d)\n", ret); > - return -EIO; > + ret = -EIO; > + goto end_unlock; > } > > if (az6007_xfer_debug) { > @@ -125,6 +130,8 @@ static int __az6007_read(struct usb_device *udev, struct az6007_device_state *st > DUMP_PREFIX_NONE, b, blen); > } > > +end_unlock: > + mutex_unlock(&d->usb_mutex); > return ret; > } > > @@ -134,25 +141,24 @@ static int az6007_read(struct dvb_usb_device *d, u8 req, u16 value, > struct az6007_device_state *st = d_to_priv(d); > int ret; > > - if (mutex_lock_interruptible(&st->mutex) < 0) > - return -EAGAIN; > - > - ret = __az6007_read(d->udev, st, req, value, index, b, blen); > - > - mutex_unlock(&st->mutex); > + ret = __az6007_read(d, st, req, value, index, b, blen); > > return ret; > } > > -static int __az6007_write(struct usb_device *udev, struct az6007_device_state *st, > +static int __az6007_write(struct dvb_usb_device *d, struct az6007_device_state *st, > u8 req, u16 value, u16 index, u8 *b, int blen) > { > int ret; > > + if (mutex_lock_interruptible(&d->usb_mutex) < 0) > + return -EAGAIN; > + > if (blen > sizeof(st->data)) { > pr_err("az6007: tried to write %d bytes, but I2C max size is %lu bytes\n", > blen, sizeof(st->data)); > - return -EOPNOTSUPP; > + ret = -EOPNOTSUPP; > + goto end_unlock; > } > > if (az6007_xfer_debug) { > @@ -162,17 +168,21 @@ static int __az6007_write(struct usb_device *udev, struct az6007_device_state *s > DUMP_PREFIX_NONE, b, blen); > } > > - ret = usb_control_msg(udev, > - usb_sndctrlpipe(udev, 0), > + ret = usb_control_msg(d->udev, > + usb_sndctrlpipe(d->udev, 0), > req, > USB_TYPE_VENDOR | USB_DIR_OUT, > value, index, b, blen, 5000); > if (ret != blen) { > pr_err("usb write operation failed. (%d)\n", ret); > - return -EIO; > + ret = -EIO; > + goto end_unlock; > } > > - return 0; > + ret = 0; > +end_unlock: > + mutex_unlock(&d->usb_mutex); > + return ret; > } > > static int az6007_write(struct dvb_usb_device *d, u8 req, u16 value, > @@ -181,12 +191,7 @@ static int az6007_write(struct dvb_usb_device *d, u8 req, u16 value, > struct az6007_device_state *st = d_to_priv(d); > int ret; > > - if (mutex_lock_interruptible(&st->mutex) < 0) > - return -EAGAIN; > - > - ret = __az6007_write(d->udev, st, req, value, index, b, blen); > - > - mutex_unlock(&st->mutex); > + ret = __az6007_write(d, st, req, value, index, b, blen); > > return ret; > } > @@ -580,10 +585,9 @@ static void az6007_ci_uninit(struct dvb_usb_device *d) > } > > > -static int az6007_ci_init(struct dvb_usb_adapter *adap) > +static int az6007_ci_init(struct dvb_usb_device *d) > { > - struct dvb_usb_device *d = adap_to_d(adap); > - struct az6007_device_state *state = adap_to_priv(adap); > + struct az6007_device_state *state = d_to_priv(d); > int ret; > > pr_debug("%s()\n", __func__); > @@ -600,7 +604,7 @@ static int az6007_ci_init(struct dvb_usb_adapter *adap) > state->ca.poll_slot_status = az6007_ci_poll_slot_status; > state->ca.data = d; > > - ret = dvb_ca_en50221_init(&adap->dvb_adap, > + ret = dvb_ca_en50221_init(&d->adapter[0].dvb_adap, > &state->ca, > 0, /* flags */ > 1);/* n_slots */ > @@ -610,6 +614,8 @@ static int az6007_ci_init(struct dvb_usb_adapter *adap) > return ret; > } > > + state->ci_attached = true; > + > pr_debug("CI initialized.\n"); > > return 0; > @@ -646,8 +652,6 @@ static int az6007_frontend_attach(struct dvb_usb_adapter *adap) > st->gate_ctrl = adap->fe[0]->ops.i2c_gate_ctrl; > adap->fe[0]->ops.i2c_gate_ctrl = drxk_gate_ctrl; > > - az6007_ci_init(adap); > - > return 0; > } > > @@ -667,8 +671,6 @@ static int az6007_cablestar_hdci_frontend_attach(struct dvb_usb_adapter *adap) > st->gate_ctrl = adap->fe[0]->ops.i2c_gate_ctrl; > adap->fe[0]->ops.i2c_gate_ctrl = drxk_gate_ctrl; > > - az6007_ci_init(adap); > - > return 0; > } > > @@ -699,50 +701,55 @@ static int az6007_power_ctrl(struct dvb_usb_device *d, int onoff) > > pr_debug("%s()\n", __func__); > > - if (!state->warm) { > - mutex_init(&state->mutex); > + mutex_lock(&d->i2c_mutex); > > + if (!state->warm) { > ret = az6007_write(d, AZ6007_POWER, 0, 2, NULL, 0); > if (ret < 0) > - return ret; > + goto end_unlock; > msleep(60); > ret = az6007_write(d, AZ6007_POWER, 1, 4, NULL, 0); > if (ret < 0) > - return ret; > + goto end_unlock; > msleep(100); > ret = az6007_write(d, AZ6007_POWER, 1, 3, NULL, 0); > if (ret < 0) > - return ret; > + goto end_unlock; > msleep(20); > ret = az6007_write(d, AZ6007_POWER, 1, 4, NULL, 0); > if (ret < 0) > - return ret; > + goto end_unlock; > > msleep(400); > ret = az6007_write(d, FX2_SCON1, 0, 3, NULL, 0); > if (ret < 0) > - return ret; > + goto end_unlock; > msleep(150); > ret = az6007_write(d, FX2_SCON1, 1, 3, NULL, 0); > if (ret < 0) > - return ret; > + goto end_unlock; > msleep(430); > ret = az6007_write(d, AZ6007_POWER, 0, 0, NULL, 0); > if (ret < 0) > - return ret; > + goto end_unlock; > > state->warm = true; > > - return 0; > + ret = 0; > + goto end_unlock; > } > > + ret = 0; > + > if (!onoff) > - return 0; > + goto end_unlock; > > az6007_write(d, AZ6007_POWER, 0, 0, NULL, 0); > az6007_write(d, AZ6007_TS_THROUGH, 0, 0, NULL, 0); > > - return 0; > +end_unlock: > + mutex_unlock(&d->i2c_mutex); > + return ret; > } > > /* I2C */ > @@ -758,7 +765,7 @@ static int az6007_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], > int length; > u8 req, addr; > > - if (mutex_lock_interruptible(&st->mutex) < 0) > + if (mutex_lock_interruptible(&d->i2c_mutex) < 0) > return -EAGAIN; > > for (i = 0; i < num; i++) { > @@ -781,7 +788,7 @@ static int az6007_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], > value = addr | (1 << 8); > length = 6 + msgs[i + 1].len; > len = msgs[i + 1].len; > - ret = __az6007_read(d->udev, st, req, value, index, > + ret = __az6007_read(d, st, req, value, index, > st->data, length); > if (ret >= len) { > for (j = 0; j < len; j++) > @@ -802,7 +809,7 @@ static int az6007_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], > index = msgs[i].buf[0]; > value = addr | (1 << 8); > length = msgs[i].len - 1; > - ret = __az6007_write(d->udev, st, req, value, index, > + ret = __az6007_write(d, st, req, value, index, > &msgs[i].buf[1], length); > } else { > /* read bytes */ > @@ -818,7 +825,7 @@ static int az6007_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], > value = addr; > length = msgs[i].len + 6; > len = msgs[i].len; > - ret = __az6007_read(d->udev, st, req, value, index, > + ret = __az6007_read(d, st, req, value, index, > st->data, length); > if (ret >= len) { > for (j = 0; j < len; j++) > @@ -829,7 +836,7 @@ static int az6007_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], > goto err; > } > err: > - mutex_unlock(&st->mutex); > + mutex_unlock(&d->i2c_mutex); > > if (ret < 0) { > pr_info("%s ERROR: %i\n", __func__, ret); > @@ -861,7 +868,7 @@ static int az6007_identify_state(struct dvb_usb_device *d, const char **name) > return -ENOMEM; > > /* Try to read the mac address */ > - ret = __az6007_read(d->udev, state, AZ6007_READ_DATA, 6, 0, mac, 6); > + ret = __az6007_read(d, state, AZ6007_READ_DATA, 6, 0, mac, 6); > if (ret == 6) > ret = WARM; > else > @@ -870,9 +877,9 @@ static int az6007_identify_state(struct dvb_usb_device *d, const char **name) > kfree(mac); > > if (ret == COLD) { > - __az6007_write(d->udev, state, 0x09, 1, 0, NULL, 0); > - __az6007_write(d->udev, state, 0x00, 0, 0, NULL, 0); > - __az6007_write(d->udev, state, 0x00, 0, 0, NULL, 0); > + __az6007_write(d, state, 0x09, 1, 0, NULL, 0); > + __az6007_write(d, state, 0x00, 0, 0, NULL, 0); > + __az6007_write(d, state, 0x00, 0, 0, NULL, 0); > } > > pr_debug("Device is on %s state\n", > @@ -880,13 +887,6 @@ static int az6007_identify_state(struct dvb_usb_device *d, const char **name) > return ret; > } > > -static void az6007_usb_disconnect(struct usb_interface *intf) > -{ > - struct dvb_usb_device *d = usb_get_intfdata(intf); > - az6007_ci_uninit(d); > - dvb_usbv2_disconnect(intf); > -} > - > static int az6007_download_firmware(struct dvb_usb_device *d, > const struct firmware *fw) > { > @@ -895,6 +895,19 @@ static int az6007_download_firmware(struct dvb_usb_device *d, > return cypress_load_firmware(d->udev, fw, CYPRESS_FX2); > } > > +static int az6007_init(struct dvb_usb_device *d) > +{ > + return az6007_ci_init(d); > +} > + > +static void az6007_exit(struct dvb_usb_device *d) > +{ > + struct az6007_device_state *state = d_to_priv(d); > + > + if (state->ci_attached) > + az6007_ci_uninit(d); > +} > + > /* DVB USB Driver stuff */ > static struct dvb_usb_device_properties az6007_props = { > .driver_name = KBUILD_MODNAME, > @@ -912,6 +925,8 @@ static struct dvb_usb_device_properties az6007_props = { > .download_firmware = az6007_download_firmware, > .identify_state = az6007_identify_state, > .power_ctrl = az6007_power_ctrl, > + .init = az6007_init, > + .exit = az6007_exit, > .num_adapters = 1, > .adapter = { > { .stream = DVB_USB_STREAM_BULK(0x02, 10, 4096), } > @@ -935,6 +950,8 @@ static struct dvb_usb_device_properties az6007_cablestar_hdci_props = { > .download_firmware = az6007_download_firmware, > .identify_state = az6007_identify_state, > .power_ctrl = az6007_power_ctrl, > + .init = az6007_init, > + .exit = az6007_exit, > .num_adapters = 1, > .adapter = { > { .stream = DVB_USB_STREAM_BULK(0x02, 10, 4096), } > @@ -955,37 +972,17 @@ static const struct usb_device_id az6007_usb_table[] = { > > MODULE_DEVICE_TABLE(usb, az6007_usb_table); > > -static int az6007_suspend(struct usb_interface *intf, pm_message_t msg) > -{ > - struct dvb_usb_device *d = usb_get_intfdata(intf); > - > - az6007_ci_uninit(d); > - return dvb_usbv2_suspend(intf, msg); > -} > - > -static int az6007_resume(struct usb_interface *intf) > -{ > - struct dvb_usb_device *d = usb_get_intfdata(intf); > - struct dvb_usb_adapter *adap = &d->adapter[0]; > - > - az6007_ci_init(adap); > - return dvb_usbv2_resume(intf); > -} > - > /* usb specific object needed to register this driver with the usb subsystem */ > static struct usb_driver az6007_usb_driver = { > - .name = KBUILD_MODNAME, > - .id_table = az6007_usb_table, > - .probe = dvb_usbv2_probe, > - .disconnect = az6007_usb_disconnect, > - .no_dynamic_id = 1, > - .soft_unbind = 1, > - /* > - * FIXME: need to implement reset_resume, likely with > - * dvb-usb-v2 core support > - */ > - .suspend = az6007_suspend, > - .resume = az6007_resume, > + .name = KBUILD_MODNAME, > + .id_table = az6007_usb_table, > + .probe = dvb_usbv2_probe, > + .disconnect = dvb_usbv2_disconnect, > + .suspend = dvb_usbv2_suspend, > + .resume = dvb_usbv2_resume, > + .reset_resume = dvb_usbv2_reset_resume, > + .no_dynamic_id = 1, > + .soft_unbind = 1, > }; > > module_usb_driver(az6007_usb_driver); > -- > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id 0P1kJ/ot7mgSfQoAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 11:03:22 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 11:03:22 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8coK-00000002tEc-1nDE for hi@josie.lol; Tue, 14 Oct 2025 11:03:22 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A1C94188D74B for ; Tue, 14 Oct 2025 11:03:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0A1972FF166; Tue, 14 Oct 2025 11:03:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZSxnVfVQ" X-Original-To: stable@vger.kernel.org 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 C55A52FE566; Tue, 14 Oct 2025 11:03:12 +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=1760439792; cv=none; b=Gjses00qXpqkCnji95NAhcF+XCEyiuYE6MqI+sfcC7LUiQo0c1GHMNDi+jeCztA2kaCCC5PcVdsI4X5VteWJs6i1CXi6L0mzIrSsJlczp/OzCm812odp8WGkA31Nrobpr1b60db014GB3n/9s1CB0SIYI0bPBDU33mHgyJqVGos= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760439792; c=relaxed/simple; bh=Ft+QUhp4GEql2Vv7pwZhfod9Y5RmF9GxI4x25ijGMbU=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=ermN62bvg+IANBSARor+j3iEW7/DyKv5JB3+hyjTge3Vk1pTsgswY8+nOCe0S+VsDEkKQ5jfJucbWhlUmyyo9Ue7zTlGtnOwkHGtPeIuzCMT/xn9FUZUxNW26R2yd3gGeC4rrMWWSJI/gj8wyco5b3zr9cZ9VJjZProyD5TJWWE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZSxnVfVQ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBE63C4CEE7; Tue, 14 Oct 2025 11:03:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760439792; bh=Ft+QUhp4GEql2Vv7pwZhfod9Y5RmF9GxI4x25ijGMbU=; h=Date:From:Subject:To:Cc:References:In-Reply-To:From; b=ZSxnVfVQP5WNnXg45rAaeaBZsEcvcgYyO3ThVyjv+e5LRWJc+h7wrKZs7GbXURvxU 6qkmUNB8EWNA11k6x4n2sAspdgPNk9JgMBQPN3haU8UiCCia5s19ueZouSxg2nssTl iIhx0JWR0J5yzlYVACgopFAR105i/gbNLZxR9TH72cY3oy5hF8wZ6p+FXVrJwuwIwp s1W6S4uxc+tMTHVZZyzz3jyUFPcaxWKicm6TaNUjO/htds/2yEAp8KR6cXwN/MM4zA ztfuOVyD/eSZ5l8AJSCgF5qMpDxK+Juz/eL8pR2QYXZo31vUu+8kyfDNxOBzg1Fffk ODfe021fNkWFg== Message-ID: <73945f29-7b1e-4738-ae50-1ae2a9c5c1df@kernel.org> Date: Tue, 14 Oct 2025 13:03:08 +0200 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: hverkuil+cisco@kernel.org Subject: Re: [PATCH v2 1/2] media: az6007: fix out-of-bounds in az6007_i2c_xfer() To: Jeongjun Park , mchehab@kernel.org, hverkuil@xs4all.nl Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, syzbot+0192952caa411a3be209@syzkaller.appspotmail.com References: <20250908150730.24560-1-aha310510@gmail.com> <20250908150730.24560-2-aha310510@gmail.com> Content-Language: en-US, nl In-Reply-To: <20250908150730.24560-2-aha310510@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -3.5 (---) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-3.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: syzkaller.appspot.com] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [147.75.80.249 listed in list.dnswl.org] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -34 On 08/09/2025 17:07, Jeongjun Park wrote: > Because the blen is not properly bounds-checked in __az6007_read/write, > it is easy to get out-of-bounds errors in az6007_i2c_xfer later. > > Therefore, we need to add bounds-checking to __az6007_read/write to > resolve this. > > Cc: > Reported-by: syzbot+0192952caa411a3be209@syzkaller.appspotmail.com > Closes: https://syzkaller.appspot.com/bug?extid=0192952caa411a3be209 > Fixes: 786baecfe78f ("[media] dvb-usb: move it to drivers/media/usb/dvb-usb") > Signed-off-by: Jeongjun Park > --- > v2: Change to fix the root cause of oob > - Link to v1: https://lore.kernel.org/all/20250421105555.34984-1-aha310510@gmail.com/ > --- > drivers/media/usb/dvb-usb-v2/az6007.c | 62 +++++++++++++++------------ > 1 file changed, 34 insertions(+), 28 deletions(-) > > diff --git a/drivers/media/usb/dvb-usb-v2/az6007.c b/drivers/media/usb/dvb-usb-v2/az6007.c > index 65ef045b74ca..4202042bdb55 100644 > --- a/drivers/media/usb/dvb-usb-v2/az6007.c > +++ b/drivers/media/usb/dvb-usb-v2/az6007.c > @@ -97,11 +97,17 @@ static struct mt2063_config az6007_mt2063_config = { > .refclock = 36125000, > }; > > -static int __az6007_read(struct usb_device *udev, u8 req, u16 value, > - u16 index, u8 *b, int blen) > +static int __az6007_read(struct usb_device *udev, struct az6007_device_state *st, > + u8 req, u16 value, u16 index, u8 *b, int blen) > { > int ret; > > + if (blen > sizeof(st->data)) { > + pr_err("az6007: tried to read %d bytes, but I2C max size is %lu bytes\n", > + blen, sizeof(st->data)); > + return -EOPNOTSUPP; > + } > + Hmm, but the pointer 'b' doesn't always point to st->data, so it makes no sense to check against it. > ret = usb_control_msg(udev, > usb_rcvctrlpipe(udev, 0), > req, > @@ -125,24 +131,30 @@ static int __az6007_read(struct usb_device *udev, u8 req, u16 value, > static int az6007_read(struct dvb_usb_device *d, u8 req, u16 value, > u16 index, u8 *b, int blen) > { > - struct az6007_device_state *st = d->priv; > + struct az6007_device_state *st = d_to_priv(d); > int ret; > > if (mutex_lock_interruptible(&st->mutex) < 0) > return -EAGAIN; > > - ret = __az6007_read(d->udev, req, value, index, b, blen); > + ret = __az6007_read(d->udev, st, req, value, index, b, blen); > > mutex_unlock(&st->mutex); > > return ret; > } > > -static int __az6007_write(struct usb_device *udev, u8 req, u16 value, > - u16 index, u8 *b, int blen) > +static int __az6007_write(struct usb_device *udev, struct az6007_device_state *st, > + u8 req, u16 value, u16 index, u8 *b, int blen) > { > int ret; > > + if (blen > sizeof(st->data)) { > + pr_err("az6007: tried to write %d bytes, but I2C max size is %lu bytes\n", > + blen, sizeof(st->data)); > + return -EOPNOTSUPP; > + } > + This makes no sense... > if (az6007_xfer_debug) { > printk(KERN_DEBUG "az6007: OUT req: %02x, value: %04x, index: %04x\n", > req, value, index); > @@ -150,12 +162,6 @@ static int __az6007_write(struct usb_device *udev, u8 req, u16 value, > DUMP_PREFIX_NONE, b, blen); > } > > - if (blen > 64) { > - pr_err("az6007: tried to write %d bytes, but I2C max size is 64 bytes\n", > - blen); > - return -EOPNOTSUPP; > - } > - ...since it is capped at 64 bytes anyway. So just keep this check since it is more stringent than sizeof(st->data). Also, 'b' doesn't always point to st->data, so it makes no sense. I think this is all overkill. There are only a few places in this driver where you are reading or writing to/from a buffer. In most cases the length is hardcoded and clearly fits inside the buffer. Only is a few places do you need to check that the length <= sizeof(st->data), and that should just be added as an extra check. Note that the msg buffers (msg[i].buf) passed to az6007_i2c_xfer are guaranteed to have the right size for the length (msg[i].len). So you only need to check when using st->data as the buffer. Sorry for basically going back to the first patch (almost). Regards, Hans > ret = usb_control_msg(udev, > usb_sndctrlpipe(udev, 0), > req, > @@ -172,13 +178,13 @@ static int __az6007_write(struct usb_device *udev, u8 req, u16 value, > static int az6007_write(struct dvb_usb_device *d, u8 req, u16 value, > u16 index, u8 *b, int blen) > { > - struct az6007_device_state *st = d->priv; > + struct az6007_device_state *st = d_to_priv(d); > int ret; > > if (mutex_lock_interruptible(&st->mutex) < 0) > return -EAGAIN; > > - ret = __az6007_write(d->udev, req, value, index, b, blen); > + ret = __az6007_write(d->udev, st, req, value, index, b, blen); > > mutex_unlock(&st->mutex); > > @@ -775,7 +781,7 @@ static int az6007_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], > value = addr | (1 << 8); > length = 6 + msgs[i + 1].len; > len = msgs[i + 1].len; > - ret = __az6007_read(d->udev, req, value, index, > + ret = __az6007_read(d->udev, st, req, value, index, > st->data, length); > if (ret >= len) { > for (j = 0; j < len; j++) > @@ -788,7 +794,7 @@ static int az6007_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], > if (az6007_xfer_debug) > printk(KERN_DEBUG "az6007: I2C W addr=0x%x len=%d\n", > addr, msgs[i].len); > - if (msgs[i].len < 1) { > + if (msgs[i].len < 1 && msgs[i].len > 64) { > ret = -EIO; > goto err; > } > @@ -796,11 +802,8 @@ static int az6007_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], > index = msgs[i].buf[0]; > value = addr | (1 << 8); > length = msgs[i].len - 1; > - len = msgs[i].len - 1; > - for (j = 0; j < len; j++) > - st->data[j] = msgs[i].buf[j + 1]; > - ret = __az6007_write(d->udev, req, value, index, > - st->data, length); > + ret = __az6007_write(d->udev, st, req, value, index, > + &msgs[i].buf[1], length); > } else { > /* read bytes */ > if (az6007_xfer_debug) > @@ -815,10 +818,12 @@ static int az6007_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], > value = addr; > length = msgs[i].len + 6; > len = msgs[i].len; > - ret = __az6007_read(d->udev, req, value, index, > + ret = __az6007_read(d->udev, st, req, value, index, > st->data, length); > - for (j = 0; j < len; j++) > - msgs[i].buf[j] = st->data[j + 5]; > + if (ret >= len) { > + for (j = 0; j < len; j++) > + msgs[i].buf[j] = st->data[j + 5]; > + } > } > if (ret < 0) > goto err; > @@ -845,6 +850,7 @@ static const struct i2c_algorithm az6007_i2c_algo = { > > static int az6007_identify_state(struct dvb_usb_device *d, const char **name) > { > + struct az6007_device_state *state = d_to_priv(d); > int ret; > u8 *mac; > > @@ -855,7 +861,7 @@ static int az6007_identify_state(struct dvb_usb_device *d, const char **name) > return -ENOMEM; > > /* Try to read the mac address */ > - ret = __az6007_read(d->udev, AZ6007_READ_DATA, 6, 0, mac, 6); > + ret = __az6007_read(d->udev, state, AZ6007_READ_DATA, 6, 0, mac, 6); > if (ret == 6) > ret = WARM; > else > @@ -864,9 +870,9 @@ static int az6007_identify_state(struct dvb_usb_device *d, const char **name) > kfree(mac); > > if (ret == COLD) { > - __az6007_write(d->udev, 0x09, 1, 0, NULL, 0); > - __az6007_write(d->udev, 0x00, 0, 0, NULL, 0); > - __az6007_write(d->udev, 0x00, 0, 0, NULL, 0); > + __az6007_write(d->udev, state, 0x09, 1, 0, NULL, 0); > + __az6007_write(d->udev, state, 0x00, 0, 0, NULL, 0); > + __az6007_write(d->udev, state, 0x00, 0, 0, NULL, 0); > } > > pr_debug("Device is on %s state\n", > -- > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id ULR0Nlc67mhljQ0AYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 11:56:07 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 11:56:07 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8ddP-00000004dRR-2Yr4 for hi@josie.lol; Tue, 14 Oct 2025 11:56:07 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id DBB494FEDF0 for ; Tue, 14 Oct 2025 11:55:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 400913101B9; Tue, 14 Oct 2025 11:55:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZuaLFccV" X-Original-To: stable@vger.kernel.org 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 1B21330F932 for ; Tue, 14 Oct 2025 11:55:16 +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=1760442918; cv=none; b=u7zigxg55j7YiA5f3GspSqpJnog2yK+qHmjMQW3ZsUhfwkuuA/UwtZoH3aJZiEioNh9JaH88vAoDcjgu0jHQbiLnirA1K1UmWgLZ/GNRhNXm7sLYB1jZmEUcdwl4pa6MYiONulkKAgSpbcT9PWsG1cg1dpX33KQF2Wdk2+u1IZA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760442918; c=relaxed/simple; bh=IUjPdMJEcBrCXAYH42rCMIC1qypN2byOqr2htwb0xXE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CPx7RdMOdOM2VqOoTkFSI3TIkU0YEU7cKACCBpjJDjT1yGRwsqa3xUdZ0qwg4rhUTnohTg80H+zKK6XBnKEj/aVxhwL2arjwNgls5gA7MqxNlODPMFWr9ITaf7W7KhGJy3jAhvZKa69N1q4ruNcdmWNNViYGTMwoOwU85KhR05M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZuaLFccV; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C601C2BC86; Tue, 14 Oct 2025 11:55:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760442916; bh=IUjPdMJEcBrCXAYH42rCMIC1qypN2byOqr2htwb0xXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZuaLFccVkGbt7bWklcuGCCRQV2CNy4chW6kp4hAh3cg8wulem4RYgLPuhnkbQvlFu xuOzCH5Tc0gk2oaFPmgFdin+U0m/h6urjq6jFqYJIr2pzfgYUDOowVenBwN5TlbxFe +pe3MzTLs5CprytpqOA4Dmrx/7DtPWyNj6EKPofbhsxZQGTA4Ss3cite7VsKPPgYie NznkcTP9N7R1HNqZi9dMN3lP8VYYYDcpqybIVqyijJWi65jVOL8xEaBRbkLJ2mgb+E 4kC9br5dxjlCPhpcEOu7/0v1a3PIOLrWFxRPv0lel9LgyoRGfzdMHGJHh0A0o9kDi8 L3ILbr3TZO8lA== From: Sasha Levin To: stable@vger.kernel.org Cc: Donet Tom , Chengming Zhou , David Hildenbrand , Aboorva Devarajan , "Ritesh Harjani (IBM)" , Wei Yang , xu xin , Andrew Morton , Sasha Levin Subject: [PATCH 6.12.y] mm/ksm: fix incorrect KSM counter handling in mm_struct during fork Date: Tue, 14 Oct 2025 07:55:13 -0400 Message-ID: <20251014115513.4165766-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2025101358-bucket-cadet-c4d4@gregkh> References: <2025101358-bucket-cadet-c4d4@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.2 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.2 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -11 From: Donet Tom [ Upstream commit 4d6fc29f36341d7795db1d1819b4c15fe9be7b23 ] Patch series "mm/ksm: Fix incorrect accounting of KSM counters during fork", v3. The first patch in this series fixes the incorrect accounting of KSM counters such as ksm_merging_pages, ksm_rmap_items, and the global ksm_zero_pages during fork. The following patch add a selftest to verify the ksm_merging_pages counter was updated correctly during fork. Test Results ============ Without the first patch ----------------------- # [RUN] test_fork_ksm_merging_page_count not ok 10 ksm_merging_page in child: 32 With the first patch -------------------- # [RUN] test_fork_ksm_merging_page_count ok 10 ksm_merging_pages is not inherited after fork This patch (of 2): Currently, the KSM-related counters in `mm_struct`, such as `ksm_merging_pages`, `ksm_rmap_items`, and `ksm_zero_pages`, are inherited by the child process during fork. This results in inconsistent accounting. When a process uses KSM, identical pages are merged and an rmap item is created for each merged page. The `ksm_merging_pages` and `ksm_rmap_items` counters are updated accordingly. However, after a fork, these counters are copied to the child while the corresponding rmap items are not. As a result, when the child later triggers an unmerge, there are no rmap items present in the child, so the counters remain stale, leading to incorrect accounting. A similar issue exists with `ksm_zero_pages`, which maintains both a global counter and a per-process counter. During fork, the per-process counter is inherited by the child, but the global counter is not incremented. Since the child also references zero pages, the global counter should be updated as well. Otherwise, during zero-page unmerge, both the global and per-process counters are decremented, causing the global counter to become inconsistent. To fix this, ksm_merging_pages and ksm_rmap_items are reset to 0 during fork, and the global ksm_zero_pages counter is updated with the per-process ksm_zero_pages value inherited by the child. This ensures that KSM statistics remain accurate and reflect the activity of each process correctly. Link: https://lkml.kernel.org/r/cover.1758648700.git.donettom@linux.ibm.com Link: https://lkml.kernel.org/r/7b9870eb67ccc0d79593940d9dbd4a0b39b5d396.1758648700.git.donettom@linux.ibm.com Fixes: 7609385337a4 ("ksm: count ksm merging pages for each process") Fixes: cb4df4cae4f2 ("ksm: count allocated ksm rmap_items for each process") Fixes: e2942062e01d ("ksm: count all zero pages placed by KSM") Signed-off-by: Donet Tom Reviewed-by: Chengming Zhou Acked-by: David Hildenbrand Cc: Aboorva Devarajan Cc: David Hildenbrand Cc: Donet Tom Cc: "Ritesh Harjani (IBM)" Cc: Wei Yang Cc: xu xin Cc: [6.6+] Signed-off-by: Andrew Morton [ replaced mm_flags_test() calls with test_bit() ] Signed-off-by: Sasha Levin --- include/linux/ksm.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/linux/ksm.h b/include/linux/ksm.h index ec9c05044d4fe..af303641819a3 100644 --- a/include/linux/ksm.h +++ b/include/linux/ksm.h @@ -57,8 +57,14 @@ static inline long mm_ksm_zero_pages(struct mm_struct *mm) static inline void ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm) { /* Adding mm to ksm is best effort on fork. */ - if (test_bit(MMF_VM_MERGEABLE, &oldmm->flags)) + if (test_bit(MMF_VM_MERGEABLE, &oldmm->flags)) { + long nr_ksm_zero_pages = atomic_long_read(&mm->ksm_zero_pages); + + mm->ksm_merging_pages = 0; + mm->ksm_rmap_items = 0; + atomic_long_add(nr_ksm_zero_pages, &ksm_zero_pages); __ksm_enter(mm); + } } static inline int ksm_execve(struct mm_struct *mm) -- 2.51.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id uNyRJBzD7Ghz3AwAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 09:15:08 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 09:15:08 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8Ee4-00000003hoe-0rJl for hi@josie.lol; Mon, 13 Oct 2025 09:15:08 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 40BC03C0F8B for ; Mon, 13 Oct 2025 09:15:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 82ED42FBE1C; Mon, 13 Oct 2025 09:15:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="1/+px40R" X-Original-To: stable@vger.kernel.org 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 5F2D22FC019 for ; Mon, 13 Oct 2025 09:15:04 +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=1760346904; cv=none; b=son/bpDjy9YmvzPpFDM3zLOpacvx4am9jLRAwUCI8eDCO8fsXZ94GsIC/eWnzBpElyS5G3+3igFENuhb3r9HgO4uah73crpL9PdqAqOMXmZOrbzJV5OzxxVEQqZnKUEUhYzCysBBD+XI3CKhlBla9vrtw5V5qjSdCoYc2xRvk8k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760346904; c=relaxed/simple; bh=5P89A/Jok9P4H+3VImQ0EGNoEcOSQ8T5ch3CLZ+kSRQ=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=YaylvoN+6pvN+cs+EwlOajfU94CfY3t6EDdbX7bl1Tt9PsOhwfM1Dvb3RVjuC1NtFfKNQVu1K8UMIWoziTKM+b2zLJojETHWK5Pz25264n4sin9qI/IUF+pKa8nEOUmmZPX6hP7BIoa22GyjlzduLUzKBHupTDhFZcRVwkz7p8k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=1/+px40R; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB44DC4CEFE; Mon, 13 Oct 2025 09:15:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760346904; bh=5P89A/Jok9P4H+3VImQ0EGNoEcOSQ8T5ch3CLZ+kSRQ=; h=Subject:To:Cc:From:Date:From; b=1/+px40Rgj3prEz0BGV87mK3Q7Sq+2L3B7vnx9WPEfE44qBCeI+SFCyW1xwu3R2wn yATkKwkwAJ/wmeWiRUqCzSU3urJ+fFuHIZMqz9/uuBaQi+6AwjeGtR6Nj/6l9PoLyS /+jRUvuh0Oo+xUuDtsv/+8bRGafhtu5Dg5si+fRs= Subject: FAILED: patch "[PATCH] mm/ksm: fix incorrect KSM counter handling in mm_struct" failed to apply to 6.12-stable tree To: donettom@linux.ibm.com,aboorvad@linux.ibm.com,akpm@linux-foundation.org,chengming.zhou@linux.dev,david@redhat.com,richard.weiyang@gmail.com,ritesh.list@gmail.com,stable@vger.kernel.org,xu.xin16@zte.com.cn Cc: From: Date: Mon, 13 Oct 2025 11:14:58 +0200 Message-ID: <2025101358-bucket-cadet-c4d4@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit X-DKIM: signer='linuxfoundation.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -18 The patch below does not apply to the 6.12-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y git checkout FETCH_HEAD git cherry-pick -x 4d6fc29f36341d7795db1d1819b4c15fe9be7b23 # git commit -s git send-email --to '' --in-reply-to '2025101358-bucket-cadet-c4d4@gregkh' --subject-prefix 'PATCH 6.12.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 4d6fc29f36341d7795db1d1819b4c15fe9be7b23 Mon Sep 17 00:00:00 2001 From: Donet Tom Date: Wed, 24 Sep 2025 00:16:59 +0530 Subject: [PATCH] mm/ksm: fix incorrect KSM counter handling in mm_struct during fork Patch series "mm/ksm: Fix incorrect accounting of KSM counters during fork", v3. The first patch in this series fixes the incorrect accounting of KSM counters such as ksm_merging_pages, ksm_rmap_items, and the global ksm_zero_pages during fork. The following patch add a selftest to verify the ksm_merging_pages counter was updated correctly during fork. Test Results ============ Without the first patch ----------------------- # [RUN] test_fork_ksm_merging_page_count not ok 10 ksm_merging_page in child: 32 With the first patch -------------------- # [RUN] test_fork_ksm_merging_page_count ok 10 ksm_merging_pages is not inherited after fork This patch (of 2): Currently, the KSM-related counters in `mm_struct`, such as `ksm_merging_pages`, `ksm_rmap_items`, and `ksm_zero_pages`, are inherited by the child process during fork. This results in inconsistent accounting. When a process uses KSM, identical pages are merged and an rmap item is created for each merged page. The `ksm_merging_pages` and `ksm_rmap_items` counters are updated accordingly. However, after a fork, these counters are copied to the child while the corresponding rmap items are not. As a result, when the child later triggers an unmerge, there are no rmap items present in the child, so the counters remain stale, leading to incorrect accounting. A similar issue exists with `ksm_zero_pages`, which maintains both a global counter and a per-process counter. During fork, the per-process counter is inherited by the child, but the global counter is not incremented. Since the child also references zero pages, the global counter should be updated as well. Otherwise, during zero-page unmerge, both the global and per-process counters are decremented, causing the global counter to become inconsistent. To fix this, ksm_merging_pages and ksm_rmap_items are reset to 0 during fork, and the global ksm_zero_pages counter is updated with the per-process ksm_zero_pages value inherited by the child. This ensures that KSM statistics remain accurate and reflect the activity of each process correctly. Link: https://lkml.kernel.org/r/cover.1758648700.git.donettom@linux.ibm.com Link: https://lkml.kernel.org/r/7b9870eb67ccc0d79593940d9dbd4a0b39b5d396.1758648700.git.donettom@linux.ibm.com Fixes: 7609385337a4 ("ksm: count ksm merging pages for each process") Fixes: cb4df4cae4f2 ("ksm: count allocated ksm rmap_items for each process") Fixes: e2942062e01d ("ksm: count all zero pages placed by KSM") Signed-off-by: Donet Tom Reviewed-by: Chengming Zhou Acked-by: David Hildenbrand Cc: Aboorva Devarajan Cc: David Hildenbrand Cc: Donet Tom Cc: "Ritesh Harjani (IBM)" Cc: Wei Yang Cc: xu xin Cc: [6.6+] Signed-off-by: Andrew Morton diff --git a/include/linux/ksm.h b/include/linux/ksm.h index 22e67ca7cba3..067538fc4d58 100644 --- a/include/linux/ksm.h +++ b/include/linux/ksm.h @@ -56,8 +56,14 @@ static inline long mm_ksm_zero_pages(struct mm_struct *mm) static inline void ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm) { /* Adding mm to ksm is best effort on fork. */ - if (mm_flags_test(MMF_VM_MERGEABLE, oldmm)) + if (mm_flags_test(MMF_VM_MERGEABLE, oldmm)) { + long nr_ksm_zero_pages = atomic_long_read(&mm->ksm_zero_pages); + + mm->ksm_merging_pages = 0; + mm->ksm_rmap_items = 0; + atomic_long_add(nr_ksm_zero_pages, &ksm_zero_pages); __ksm_enter(mm); + } } static inline int ksm_execve(struct mm_struct *mm) From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id aMnYNkxB7mhcDw4AYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 12:25:48 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 12:25:48 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8e68-00000005cOh-1i4G for hi@josie.lol; Tue, 14 Oct 2025 12:25:48 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id F14321925FBB for ; Tue, 14 Oct 2025 12:26:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 70A5A313551; Tue, 14 Oct 2025 12:25:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="A8XfJO2I" X-Original-To: stable@vger.kernel.org Received: from out-177.mta0.migadu.com (out-177.mta0.migadu.com [91.218.175.177]) (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 48B97313E05 for ; Tue, 14 Oct 2025 12:25:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760444728; cv=none; b=Us3iTXhFOpbmjRc5Ctap2lhNQWP226kR5l2JWK6vJ7uHQ7vPqN+WOgFj/NFelaC8zl98lbwyoxpoWvSIKkxWhGq4a+vDxMyOWrcqTU19caRiZbeaUctY2qhGNpZA5f2pmLiTqKXE3HhQBfDXP3I+XuQQKTHQyuDVAx9pRw2jeOM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760444728; c=relaxed/simple; bh=XFOLr/cnekypotduLRqnkNRiLqmpK6WX/6E02roh9sg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=O0/3PfkDi8LU+dSwXM/VE9xikvV4TAsJjwIZSvFz1vfofyz5HW4C74PQ8kMTGpHMfwSAhauF8vX5T7R69Vr++5vQT2gkY3J8zNf2pDLIGb6YD/BYElaNNnu3L0kXvJAyhKvj5G5fv8YzV+iE0p5HCB5eBORRQMzPO38M90Ir2Po= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=A8XfJO2I; arc=none smtp.client-ip=91.218.175.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1760444722; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hEyKC0rXBxwWC68IHciD57Sf1EbPHHc3LfBBqhTpsxE=; b=A8XfJO2IaHs0uBIzI1sOG5BrgAcC/xVeyCtYb1cJSlO53QVE5Hu99nfMcQOO9jsHYLFeKP HAWri20mPdxvd80KXySc9d8mZZLTAUWFiNulkUNM+i0MC2J0mLe8yF2/y2UGGvLLIlwbo6 FzInSHzUp00rt1na9sF4jeqlMoaiz7c= Date: Tue, 14 Oct 2025 20:25:12 +0800 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v5 1/1] mm/rmap: fix soft-dirty and uffd-wp bit loss when remapping zero-filled mTHP subpage to shared zeropage Content-Language: en-US To: Lorenzo Stoakes Cc: akpm@linux-foundation.org, david@redhat.com, peterx@redhat.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com, baohua@kernel.org, ryan.roberts@arm.com, dev.jain@arm.com, npache@redhat.com, riel@surriel.com, Liam.Howlett@oracle.com, vbabka@suse.cz, harry.yoo@oracle.com, jannh@google.com, matthew.brost@intel.com, joshua.hahnjy@gmail.com, rakie.kim@sk.com, byungchul@sk.com, gourry@gourry.net, ying.huang@linux.alibaba.com, apopple@nvidia.com, usamaarif642@gmail.com, yuzhao@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, ioworker0@gmail.com, stable@vger.kernel.org References: <20250930081040.80926-1-lance.yang@linux.dev> <91c443e1-3d7d-4b95-ab62-b970b047936f@lucifer.local> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Lance Yang In-Reply-To: <91c443e1-3d7d-4b95-ab62-b970b047936f@lucifer.local> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-DKIM: signer='linux.dev' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linux.dev] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [147.75.80.249 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: -18 Thanks for the super energetic review! On 2025/10/14 19:19, Lorenzo Stoakes wrote: > Feels like the mTHP implementation is hitting up on the buffers of the THP code > being something of a mess... :) Haha, yeah, it really feels that way sometimes ;) > > On Tue, Sep 30, 2025 at 04:10:40PM +0800, Lance Yang wrote: >> From: Lance Yang >> >> When splitting an mTHP and replacing a zero-filled subpage with the shared >> zeropage, try_to_map_unused_to_zeropage() currently drops several important >> PTE bits. >> >> For userspace tools like CRIU, which rely on the soft-dirty mechanism for > > It's slightly by-the-by, but CRIU in my view - as it relies on kernel > implementation details that can always change to operate - is not actually > something we have to strictly keep working. > > HOWEVER, if we can reasonably do so without causing issues for us in the kernel > we ought to do so. > >> incremental snapshots, losing the soft-dirty bit means modified pages are >> missed, leading to inconsistent memory state after restore. >> >> As pointed out by David, the more critical uffd-wp bit is also dropped. >> This breaks the userfaultfd write-protection mechanism, causing writes >> to be silently missed by monitoring applications, which can lead to data >> corruption. > > Again, uffd-wp is a total mess. We shouldn't be in a position where its state > being correctly retained relies on everybody always getting the subtle, > uncommented, open-coded details right everywhere all the time. > > But this is again a general comment... :) :) > >> >> Preserve both the soft-dirty and uffd-wp bits from the old PTE when >> creating the new zeropage mapping to ensure they are correctly tracked. >> >> Cc: >> Fixes: b1f202060afe ("mm: remap unused subpages to shared zeropage when splitting isolated thp") >> Suggested-by: David Hildenbrand >> Suggested-by: Dev Jain >> Acked-by: David Hildenbrand >> Reviewed-by: Dev Jain >> Signed-off-by: Lance Yang > > Overall LGTM, so: > > Reviewed-by: Lorenzo Stoakes Cheers! > >> --- >> v4 -> v5: >> - Move ptep_get() call after the !pvmw.pte check, which handles PMD-mapped >> THP migration entries. >> - https://lore.kernel.org/linux-mm/20250930071053.36158-1-lance.yang@linux.dev/ >> >> v3 -> v4: >> - Minor formatting tweak in try_to_map_unused_to_zeropage() function >> signature (per David and Dev) >> - Collect Reviewed-by from Dev - thanks! >> - https://lore.kernel.org/linux-mm/20250930060557.85133-1-lance.yang@linux.dev/ >> >> v2 -> v3: >> - ptep_get() gets called only once per iteration (per Dev) >> - https://lore.kernel.org/linux-mm/20250930043351.34927-1-lance.yang@linux.dev/ >> >> v1 -> v2: >> - Avoid calling ptep_get() multiple times (per Dev) >> - Double-check the uffd-wp bit (per David) >> - Collect Acked-by from David - thanks! >> - https://lore.kernel.org/linux-mm/20250928044855.76359-1-lance.yang@linux.dev/ >> >> mm/migrate.c | 15 ++++++++++----- >> 1 file changed, 10 insertions(+), 5 deletions(-) >> >> diff --git a/mm/migrate.c b/mm/migrate.c >> index ce83c2c3c287..e3065c9edb55 100644 >> --- a/mm/migrate.c >> +++ b/mm/migrate.c >> @@ -296,8 +296,7 @@ bool isolate_folio_to_list(struct folio *folio, struct list_head *list) >> } >> >> static bool try_to_map_unused_to_zeropage(struct page_vma_mapped_walk *pvmw, >> - struct folio *folio, >> - unsigned long idx) >> + struct folio *folio, pte_t old_pte, unsigned long idx) >> { >> struct page *page = folio_page(folio, idx); >> pte_t newpte; >> @@ -306,7 +305,7 @@ static bool try_to_map_unused_to_zeropage(struct page_vma_mapped_walk *pvmw, >> return false; >> VM_BUG_ON_PAGE(!PageAnon(page), page); >> VM_BUG_ON_PAGE(!PageLocked(page), page); >> - VM_BUG_ON_PAGE(pte_present(ptep_get(pvmw->pte)), page); >> + VM_BUG_ON_PAGE(pte_present(old_pte), page); > > Kinda ugly that we pass old_pte when it's avaiable via the shared state object, > but probably nothing to really concern ourselves about. > > Guess you could argue it both ways :) > > It'd be good to convert these VM_BUG_ON_*() to VM_WARN_ON_*() but I guess that's I agree. > somewhat out of the scope of the code here and would be inconsistent to change > it for just one condition. Since this fix already landed in the mainline, just leave it as is here :) Thanks, Lance From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id mCa1E94x7mhzUAwAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 11:19:58 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 11:19:58 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8d4P-00000003Rgm-46CD for hi@josie.lol; Tue, 14 Oct 2025 11:19:58 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 08C334E43D0 for ; Tue, 14 Oct 2025 11:19:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4673F2FD1B0; Tue, 14 Oct 2025 11:19:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="o7rZejSs"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="OeQEfBet" X-Original-To: stable@vger.kernel.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (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 57E2F1DFCB; Tue, 14 Oct 2025 11:19:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760440794; cv=fail; b=TNKXykmrZ0C2RvV2EzTrbiDwoLiI35wCQe5J9Sw7qI+UN4v2BmCp/nUprNaIczWg4VKaBwhEbSM69yPuwpwXBvd35K5pRxqXJKxKXSrKcDGdA2jVmJu4cC0ke7HNOhXq8Qxd6rZDHolDyGIs8CSB6Z7c0HOWmAEYNZlh4/cfSqM= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760440794; c=relaxed/simple; bh=jX33wVJe+ZInSbC3vwSrPGfJUBM1k95seBRD5ITDUYc=; h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=DVSL7VI2ZqZcDz6vufjgcyenoVyYlr+KG6abMJc3uZj4l/1+eH3k+OBvIxwmbmKatmHolDTLiXAmg9D7ckdddbIT9y6qDEkINxOlvmzHBkiM8qZZtJp0dkDbhVah9b6CrZnZKH5bbvOmngg4sAMTxgR8nDgmUSDGfSD9AK1UN/A= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=o7rZejSs; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=OeQEfBet; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 59EB9jRi019475; Tue, 14 Oct 2025 11:19:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=corp-2025-04-25; bh=suFKQMIfs0Q2QF3DBn xAaqLHnV6Il4xSGHFcQn1hmG8=; b=o7rZejSsYT/rUrolSzN4+cIQunz+uh61HJ E1QdTR3SSW1yYYZWwQ6FrZs8sNN3eydrnseaHbq2iPWAsI5lR9SlYZoAwBLZjVGl AIpRt0/3B94az47hGEuaNsDEzzLv7I1zjE1TpzPt4swsq/6z0jZ0l8QPd9n03Oal Eb0Y/YCdPxosHGbj/DqpUg8nUWtRu0v9XQF8rhVYHYI98kA9UOwm2wRvOocBwcd3 hvXSRQHSHVjwDLFqv5HspzvObL0A1EAOPsTuwWOymztnm3sMNcWjoWHrwBjQYN++ dZutjdAiAkWRbDwwlO/y+N/zok15LOHdrHBI8T+07P/tE77g5Y3w== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 49qfsrv29f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Oct 2025 11:19:18 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 59E92JE2017703; Tue, 14 Oct 2025 11:19:17 GMT Received: from cy7pr03cu001.outbound.protection.outlook.com (mail-westcentralusazon11010004.outbound.protection.outlook.com [40.93.198.4]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 49qdp8scv5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Oct 2025 11:19:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KsfOsoy8nRK2W1o9XrA29Vt6zHptCINeAZ4qAGVShu+FB2Sw2igljRrLxqF5AbFzNo33Zi45W05cO5MhmGukFhhde1WuBzONXXRJpu8Ew+SehA8ZhN/eJkOntJBJ1YvVgf0KqfVDPca37QLNANhJTWX5vL9W9rpb1A40C6rG5/UWncKDXkve7ioG+vCAOq+wPiSItfXw7cX73dTo77P7ZaMOu0ipWwnmigzV/SPXYb+lSTSSuqDo8lxKdvLatCC+Szhey2etnbVa8w7+xYwMjl/RMeh+tlSyb1P+QCQdbA9wyE6w+/Brs5yOsEyqRAcp2+qWRRglIEUZDBwVOzWgbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=suFKQMIfs0Q2QF3DBnxAaqLHnV6Il4xSGHFcQn1hmG8=; b=crN9uL81c98MOTu0/ZOm5elgKPv1+B+WOgNpETD9LvzN14JU4GQ8H6u4z7KBkjt8zgexgAqbQLGs4zqLVzigH9CeJsLyOKl+5Cm0a23brqX/joYHW5nTRLhqYDlN9tFwV0zapCW1gblWgDPeLFeP7O4Q/dNnwarTlvtE3cWLC6tCKfwrWoIrqbYJoVH3Ap2vr3YErCOQEbLYa40pxXCAFCuviEm+Yuo3zMf/i0AE35aRo39ZgqNjaL4QZYdu3167ajdXfBK6HAJkAkoExZMPU0E1iRCG6ABiXkIUWTDJQtyQv01lIux31MZGsJtZe6w+SjMhQ9iInFotf7+RleGSbA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=suFKQMIfs0Q2QF3DBnxAaqLHnV6Il4xSGHFcQn1hmG8=; b=OeQEfBetfd0zYuVMUC2aEZKXGduNFEhDg5RB2liHRAkldVXDGot8VNNs/y70jwPIbmTDlx8bi1QFbvM0nHQ26HDSOoZ1wueaLMRZQUgPgB3m3cupZSXTs2WG8V3KnBvC6b+BuwqyJu1Wkr2NkCuq8Yu2xnwRfptMIOPcwKPquac= Received: from DM4PR10MB8218.namprd10.prod.outlook.com (2603:10b6:8:1cc::16) by DM6PR10MB4315.namprd10.prod.outlook.com (2603:10b6:5:219::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9228.10; Tue, 14 Oct 2025 11:19:14 +0000 Received: from DM4PR10MB8218.namprd10.prod.outlook.com ([fe80::2650:55cf:2816:5f2]) by DM4PR10MB8218.namprd10.prod.outlook.com ([fe80::2650:55cf:2816:5f2%2]) with mapi id 15.20.9203.009; Tue, 14 Oct 2025 11:19:14 +0000 Date: Tue, 14 Oct 2025 12:19:11 +0100 From: Lorenzo Stoakes To: Lance Yang Cc: akpm@linux-foundation.org, david@redhat.com, peterx@redhat.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com, baohua@kernel.org, ryan.roberts@arm.com, dev.jain@arm.com, npache@redhat.com, riel@surriel.com, Liam.Howlett@oracle.com, vbabka@suse.cz, harry.yoo@oracle.com, jannh@google.com, matthew.brost@intel.com, joshua.hahnjy@gmail.com, rakie.kim@sk.com, byungchul@sk.com, gourry@gourry.net, ying.huang@linux.alibaba.com, apopple@nvidia.com, usamaarif642@gmail.com, yuzhao@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, ioworker0@gmail.com, stable@vger.kernel.org Subject: Re: [PATCH v5 1/1] mm/rmap: fix soft-dirty and uffd-wp bit loss when remapping zero-filled mTHP subpage to shared zeropage Message-ID: <91c443e1-3d7d-4b95-ab62-b970b047936f@lucifer.local> References: <20250930081040.80926-1-lance.yang@linux.dev> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250930081040.80926-1-lance.yang@linux.dev> X-ClientProxiedBy: LO4P123CA0127.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:193::6) To DM4PR10MB8218.namprd10.prod.outlook.com (2603:10b6:8:1cc::16) Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR10MB8218:EE_|DM6PR10MB4315:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e26513e-f472-4456-5774-08de0b1381e8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|366016|7053199007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Yk2nBIV4qznzohhJEomHsgwKzAg8aC2qv6BMH1VsF/v+GbnF1VpsaJ7GqPmO?= =?us-ascii?Q?qIu4Vk5Dvx73t7jD7QLtVXUGrQLWMJ1iMK1fQglHZCC2YEEc23UrRvcXyQ3K?= =?us-ascii?Q?DCWzM2gh0sZPUXGJEGXhnqYsrCNcW3LALgwJLIPpzcLrWI8nibQTCpbX+iKV?= =?us-ascii?Q?nhVeeFF0cp7w+aAL2wKLs132kp853e45X84oSBihZb7p8kC+AfcQyIhPJenW?= =?us-ascii?Q?b+WOxBWuQScD9nG04IfVj1AdlZg5awzdTCL20NKFX2AvkRW0c/o07SVp94Rv?= =?us-ascii?Q?FIwc1h6H0i0GR56l59iFR8jVphFUr+EMLzciFRRked9tYPGDROTftvOTBxcA?= =?us-ascii?Q?q7K8TNdx3cL/5y3xWQqoPmyD2GGYUck0Lcc86ngMd8p3NJSqa8ML02/I+Wnd?= =?us-ascii?Q?XZLAnhAjSmzJg9A4yXBpoHnUOp+rl4bP0yXvgsOJI5GuUYbr8t8bfZflN0XA?= =?us-ascii?Q?Cp8oEhLTy/jAtMeCkhsCQgv5sAtLzp9SJa4nz6OlE7cBWNEo1iorEgmVdo6p?= =?us-ascii?Q?s1qhkT1cuK3jHUVKtag9fG54tdCzkNZIcr+aqX/N88aE+CknQTXUTADM0Lcc?= =?us-ascii?Q?/gQpibh3zTqhqJN0L5ESrEjsUJKnOxgrU+GUR7mCpI69/7FVtL+GYojyyEBM?= =?us-ascii?Q?t6ueQlD1SZBxqxA2VK8qI4itR/0xnheOX8pB7Om+eeJ4niQMemVQT3jLXxKY?= =?us-ascii?Q?juIxi5QIDj86iCTPwrHONddwK+w9XU9CSuM+eBEo9V7qej1+fYvF+PVNqN/N?= =?us-ascii?Q?TqwyI4/r1qUMymVo6svy4qQcl7+c37l3i58LJ6mVgInEoEmX639R5Wg4RUAm?= =?us-ascii?Q?xAHdMRj0qbzilnEB7PNiwP6N9HI1/JUpWmef0AaqI+6xRoeX61lA6x/lSPdT?= =?us-ascii?Q?9BwEv5JlMzZOXUXHJq5Mfk+IrWTTaFGQ9zqOw4qrmCm4KYnfTW+iao6m5e4n?= =?us-ascii?Q?qHQ8Z32seOiO/05Bbh1eEaHG52OMK5IbsAbRzlU9YpMHaCrkZD9i18Xk4hEo?= =?us-ascii?Q?h2WzHXsqvqkdtPB6QVSNd6Cjo7aiqKIuzybsQOgqeJnnzF3xHNSEGjAcpYvH?= =?us-ascii?Q?FzHOX16k8M9dA3k6Cj67XrHKm5zqPMWocPx4uoNGzKhKGNGj32AWENsRR/hb?= =?us-ascii?Q?A61dZBQJZMMr9U64JCB9bH6SwOvCoWyn4KTr5SD06SgJVOeqXb6pmos2vW0O?= =?us-ascii?Q?xuDnAoSQQvomwTn1xm9LY+fsIgRN/FKGyCIwXWKkJMCkKJDyxwOSVG4+mew+?= =?us-ascii?Q?Afc465yo97ERxsNKF1OazcI5/fTKrkyUW83isxxjgUiz+vb3dY4+fpTyEWlE?= =?us-ascii?Q?oR62e3kZEtnnf7iMFVbq3yVOneLcwEWxDnRBuOaJ58gs8PA9G20G7Xzrnja6?= =?us-ascii?Q?BgyG6xPpEcQDAsyCglZaJTQIhvi4/2yqJWqS6CNkzT+qxPO32pl9IVLaWNN+?= =?us-ascii?Q?jI1PlT3KFAI8Vk5ddhZX6GXHWuNElCtDBUHcrAG1RYEjYJEYUvsHDg=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR10MB8218.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(1800799024)(366016)(7053199007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?C3XIFXy7ej3gwPGg/G6VTDqEWOsch12PG33X5cAIWTkZnYPlUFb6UC/jeyNo?= =?us-ascii?Q?mz9+vR3QD8YFVSqMeNYvjLe2ERPMKboxWyA7c/UYH+AsOzHfuDz2oPhr/9hv?= =?us-ascii?Q?PL5H2/pndSwQok0hCmeCyDZm67NhNUEbDOQGHNGooBObwM6FHz0bA+gCwTIR?= =?us-ascii?Q?16WOoS8eG6fWjjsKV6Em35W1wT0QVaqhZFCrrq4G2z+7PkQv9MGC8fm4feNZ?= =?us-ascii?Q?G9/4vqX4onRazjph08QQVhD3vhIaCxhG32I7gHT2CvazQKTBgFiOC6zexJnk?= =?us-ascii?Q?m4BB3cOdN+LHlDQJti1/ICXlbnIoJk2l68htdePzyqmeo9yDOcJvfYF3zzqR?= =?us-ascii?Q?TaFExre5jGEMiTrM4GvW/GpLtZkp1MoHGVDOmXG/o1QmgY8nf4wkIEjq91eZ?= =?us-ascii?Q?vy03e6Mcw6grjzRy0nqtHWx+YJsnDFmk50EIh0GQi9o1FntPsuEJBxELRgrS?= =?us-ascii?Q?R8Y/1ulPQiOizL5Qez+h6ckJUK3u6cKig+J5JFEkUTESA8roRgj02cR2D7sA?= =?us-ascii?Q?z4EMw66zWH+6b1QopJiQW7XXYlbY/Vbj3QsYpu8g5JGT6grqgTBEOOnmzJ49?= =?us-ascii?Q?4SeZWia4ZwElaZ7mZEnTDTFsjx82joB63I1fUCPc+nF3DFDdIbrfmN/xU/a/?= =?us-ascii?Q?SgccpBhVXf48H+w4vaj//OrevSACebZWMAZl7KR76n4VchrKX5TsHideR1hN?= =?us-ascii?Q?407mKkMV/XJNTmQN6vnz6VAGKz/Vw3S7ctG7twkU5251hfY+WblEt9w5Prcx?= =?us-ascii?Q?ZbgHjBWjdYDRrMpugY15oSq+VS0CqUJeNOrfPINm9YMI4J0h4iQ60ns5lU8T?= =?us-ascii?Q?e7mECq2oW50Y9cmOB8lynJBtxVSr1fDEpFFffVmjgxyBHb1Mw2weTplApBq/?= =?us-ascii?Q?DjTPcdJsVZEKvzXMx9Z32y2BVmlfbinDdP9YOgqgDJmqfB0pPytOM7tkB0tj?= =?us-ascii?Q?4EDy2LfbmSeOrBkzGHPI1EyvHweMoBDFpCtYyQ6dPdsnuBaDkOU0NStnetCO?= =?us-ascii?Q?zf2Bk6iiWHIm0OpXy8qVQpzmV+QfTgd3ohkjrTwVN12JXex1BLwO6ZeFLQaT?= =?us-ascii?Q?QciaJl2eYn0JzDn9mbnfHCAYi0hOZDhY64FbMFBPuFZpKJ3wBYpDzTaUJ534?= =?us-ascii?Q?LDi/m9AQjyEFHhp5dysZ4EAFmkGkAJKQIZXdG32sYdS0dZgdCo69DfunTOsP?= =?us-ascii?Q?0H4V1Qmpdj6sFy6Pm2f/Qpkt8sxh5J7EnDWcexedsHmVo+D/uGVnJAwAtpWc?= =?us-ascii?Q?gxzG+TOOuShfF8KdmLfvCAIvjlU5mY+sRu785lJhmPz2jIZAXV9pUashetg1?= =?us-ascii?Q?7697MBtO4P64+RlwIa3AwqIUXCy+Q4JEVJpCBZcB+0g/2KJGIDj0oftSLK7Y?= =?us-ascii?Q?6qsSJXmXcFXRBe9bApPyNX/R9VLth55aOQ+lxlpQyzBqi+uPRJyNN24B7X1p?= =?us-ascii?Q?6YZt9+7l6VAMdM+DqBI4yJIbKSNTVZk/MdsY2t5pq0DNcSwidtvgrG3jKXbP?= =?us-ascii?Q?wwhSuY4SDIY0CqLiNuf3hzs0cmkfz/EfP1DRzxGReqdi31IMz8ckJEKp3a+h?= =?us-ascii?Q?YKdJ5oc+eeW3wpAwuvYd0eyyMr8FXMbhVbEmCyu1sVU5PPRP6qr2TWVXPkW0?= =?us-ascii?Q?BA=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: e1tTRRcGumZjeuUDoO76B878lBc5R4I08oNWqy/pBFHXtmgn+kCRChoaN6D1YTEKQeUzH9KHWLVDG08SyK1khdhqQIg+9avAHbCillOCg0LxBni4QPOPpyESvzjP9Q2ex+HzXiXWcj41berpe5Jp1aWrDR6sN5RS0AVkXTCNEYwU2ZuLqZrg7WJIVR84whtplx3iUW3g0992wCoev4ZTXQzkXe3EJYyDyWRTN780m5Oz4mhLrGE0g2yYJRrQNUiZmzDdZmMyCH16VgIF0gM3efJ2XhgmAjhBQ6bd6uCL/raQa+qk+bO+arDq5k6us0+OTDXaAFbrDRqR2bHLauDbrxjYCx4v0JV+i5vgVBTffjhxrqRvPFHxt5JUMtcaLgXHaGke7Rda2ODx8r0uF5SJEHTVIRGKly36zZ56gij+4ynw+UijX1DP9FAU/xZ5U0pQ90bCN88DXXRTiagL2fMEAZhDSCXPg7yani60WN9bc/zPsX9KOE5i7+1Ac2hscwb5RgKQhX3jhP+RQX7RSeXd8dxpUEIFi8gp6mCQnoZFX0cZNMP45Mtq48ILmYUDM4nV0eQ6V3X+dxDpQensNTzBA38Al0fh312c0JwqsKJXW8U= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e26513e-f472-4456-5774-08de0b1381e8 X-MS-Exchange-CrossTenant-AuthSource: DM4PR10MB8218.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2025 11:19:14.6578 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nkwvyolqsvNN+9ngIiNuHvPoJxX+/lgXRqlE9SDr+lYMiAG+GE57blsBi1H7d587+F5I07Wz0etSpBOC41R1muhiVKdgSZ4wID/EVSRTOjU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4315 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-14_02,2025-10-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 mlxscore=0 suspectscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2510020000 definitions=main-2510140089 X-Proofpoint-GUID: 1aGCl2FvqSO2s-5Sr8f2ejICJoGeCbQv X-Authority-Analysis: v=2.4 cv=APfYzRIR c=1 sm=1 tr=0 ts=68ee31b6 b=1 cx=c_pps a=WeWmnZmh0fydH62SvGsd2A==:117 a=WeWmnZmh0fydH62SvGsd2A==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=x6icFKpwvdMA:10 a=GoEa3M9JfhUA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VwQbUJbxAAAA:8 a=20KFwNOVAAAA:8 a=7CQSdrXTAAAA:8 a=yPCof4ZbAAAA:8 a=ZpJBA3WTnvw9DzHdlOIA:9 a=CjuIK1q_8ugA:10 a=a-qgeE7W1pNrGK8U0ZQC:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDExMDAyMSBTYWx0ZWRfX5ci8lYd9zuDh Y45yj17VmCfdZueFldovlnQhWNqX0HhhIFnhSVyGigxVSJKNw4EUKE4ZU/rf23YDjZ2O7V8IVol uaifHKvMC3arCuUa2eM16wA4enpX3eTCMSz96Zu6Zas9rNCfcARAzrjARDZ7Or8+c9zHCM79KWk jUAMnTQHN5EhO8Eu43fWtdsLe8+6aLVe6S9AF0sfTrWMooBmWOa4MyvODOu6MQgZ23DzKUJSpIP 1tPA/Iy5hU+XZFbCrG2b3SC4HQgPisGbDV6Mw0x/SEfnlIX0qxn5l9Rp7Yr30z6U/oZTXoXKf13 30P6o6GmXSiIxbR/z/VWMce4GwVSgx6x9bToFwmyiOIz+Vl/9PHsA1JB9SoLG9tfET6TG2Aoqoh IB0KC3dp9tNb0htxVq3yOeoQ3Q8SxQ== X-Proofpoint-ORIG-GUID: 1aGCl2FvqSO2s-5Sr8f2ejICJoGeCbQv X-DKIM: signer='oracle.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-DKIM: signer='oracle.onmicrosoft.com' status='pass' reason='' X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 Feels like the mTHP implementation is hitting up on the buffers of the THP code being something of a mess... :) On Tue, Sep 30, 2025 at 04:10:40PM +0800, Lance Yang wrote: > From: Lance Yang > > When splitting an mTHP and replacing a zero-filled subpage with the shared > zeropage, try_to_map_unused_to_zeropage() currently drops several important > PTE bits. > > For userspace tools like CRIU, which rely on the soft-dirty mechanism for It's slightly by-the-by, but CRIU in my view - as it relies on kernel implementation details that can always change to operate - is not actually something we have to strictly keep working. HOWEVER, if we can reasonably do so without causing issues for us in the kernel we ought to do so. > incremental snapshots, losing the soft-dirty bit means modified pages are > missed, leading to inconsistent memory state after restore. > > As pointed out by David, the more critical uffd-wp bit is also dropped. > This breaks the userfaultfd write-protection mechanism, causing writes > to be silently missed by monitoring applications, which can lead to data > corruption. Again, uffd-wp is a total mess. We shouldn't be in a position where its state being correctly retained relies on everybody always getting the subtle, uncommented, open-coded details right everywhere all the time. But this is again a general comment... :) > > Preserve both the soft-dirty and uffd-wp bits from the old PTE when > creating the new zeropage mapping to ensure they are correctly tracked. > > Cc: > Fixes: b1f202060afe ("mm: remap unused subpages to shared zeropage when splitting isolated thp") > Suggested-by: David Hildenbrand > Suggested-by: Dev Jain > Acked-by: David Hildenbrand > Reviewed-by: Dev Jain > Signed-off-by: Lance Yang Overall LGTM, so: Reviewed-by: Lorenzo Stoakes > --- > v4 -> v5: > - Move ptep_get() call after the !pvmw.pte check, which handles PMD-mapped > THP migration entries. > - https://lore.kernel.org/linux-mm/20250930071053.36158-1-lance.yang@linux.dev/ > > v3 -> v4: > - Minor formatting tweak in try_to_map_unused_to_zeropage() function > signature (per David and Dev) > - Collect Reviewed-by from Dev - thanks! > - https://lore.kernel.org/linux-mm/20250930060557.85133-1-lance.yang@linux.dev/ > > v2 -> v3: > - ptep_get() gets called only once per iteration (per Dev) > - https://lore.kernel.org/linux-mm/20250930043351.34927-1-lance.yang@linux.dev/ > > v1 -> v2: > - Avoid calling ptep_get() multiple times (per Dev) > - Double-check the uffd-wp bit (per David) > - Collect Acked-by from David - thanks! > - https://lore.kernel.org/linux-mm/20250928044855.76359-1-lance.yang@linux.dev/ > > mm/migrate.c | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/mm/migrate.c b/mm/migrate.c > index ce83c2c3c287..e3065c9edb55 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -296,8 +296,7 @@ bool isolate_folio_to_list(struct folio *folio, struct list_head *list) > } > > static bool try_to_map_unused_to_zeropage(struct page_vma_mapped_walk *pvmw, > - struct folio *folio, > - unsigned long idx) > + struct folio *folio, pte_t old_pte, unsigned long idx) > { > struct page *page = folio_page(folio, idx); > pte_t newpte; > @@ -306,7 +305,7 @@ static bool try_to_map_unused_to_zeropage(struct page_vma_mapped_walk *pvmw, > return false; > VM_BUG_ON_PAGE(!PageAnon(page), page); > VM_BUG_ON_PAGE(!PageLocked(page), page); > - VM_BUG_ON_PAGE(pte_present(ptep_get(pvmw->pte)), page); > + VM_BUG_ON_PAGE(pte_present(old_pte), page); Kinda ugly that we pass old_pte when it's avaiable via the shared state object, but probably nothing to really concern ourselves about. Guess you could argue it both ways :) It'd be good to convert these VM_BUG_ON_*() to VM_WARN_ON_*() but I guess that's somewhat out of the scope of the code here and would be inconsistent to change it for just one condition. > > if (folio_test_mlocked(folio) || (pvmw->vma->vm_flags & VM_LOCKED) || > mm_forbids_zeropage(pvmw->vma->vm_mm)) > @@ -322,6 +321,12 @@ static bool try_to_map_unused_to_zeropage(struct page_vma_mapped_walk *pvmw, > > newpte = pte_mkspecial(pfn_pte(my_zero_pfn(pvmw->address), > pvmw->vma->vm_page_prot)); > + > + if (pte_swp_soft_dirty(old_pte)) > + newpte = pte_mksoft_dirty(newpte); > + if (pte_swp_uffd_wp(old_pte)) > + newpte = pte_mkuffd_wp(newpte); > + > set_pte_at(pvmw->vma->vm_mm, pvmw->address, pvmw->pte, newpte); > > dec_mm_counter(pvmw->vma->vm_mm, mm_counter(folio)); > @@ -364,13 +369,13 @@ static bool remove_migration_pte(struct folio *folio, > continue; > } > #endif > + old_pte = ptep_get(pvmw.pte); > if (rmap_walk_arg->map_unused_to_zeropage && > - try_to_map_unused_to_zeropage(&pvmw, folio, idx)) > + try_to_map_unused_to_zeropage(&pvmw, folio, old_pte, idx)) > continue; > > folio_get(folio); > pte = mk_pte(new, READ_ONCE(vma->vm_page_prot)); > - old_pte = ptep_get(pvmw.pte); > > entry = pte_to_swp_entry(old_pte); > if (!is_migration_entry_young(entry)) > -- > 2.49.0 > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id oL2OIjCk3mi/JjQAYBR5ng (envelope-from ) for ; Thu, 02 Oct 2025 16:11:28 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Thu, 02 Oct 2025 16:11:28 +0000 Received: from ny.mirrors.kernel.org ([147.75.199.223]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v4Ltw-0000000FCgR-0kny for hi@josie.lol; Thu, 02 Oct 2025 16:11:28 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5AB4D164ECA for ; Thu, 2 Oct 2025 16:11:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6CFF6221275; Thu, 2 Oct 2025 16:11:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="mdwykPfQ"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="xVVdiHSy" X-Original-To: stable@vger.kernel.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (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 954922BD03; Thu, 2 Oct 2025 16:11:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759421484; cv=fail; b=gQIFAAfqpdAYu1yuU0dTuCyvkfD4jjJH2XKhw3xHFR2b7+ksdPe8Iyh6Z1hnUet0/lGeKUCf3kXR+PQGpSqNjIoVotwoPVaMXcEPxSP01SRIkOYvG6nle5OMf3VVfz/oOyrvZnrovjbEswjeP19+1AYO9hzF9K0oxIs6UK0iylY= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759421484; c=relaxed/simple; bh=GHSHVlflmwKbbOoqQtnqAdi+9AfpMp8Xl9e/VcTGUI4=; h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=d3JN8RaVzhwKwUUZShelNCaWY4B41dgsdu4g+I+ej+Pi9PFiMCyx6BazvVcl62Nx/MXrVx5fnZPmV6XVoqZfp7WRRVPXgYIkMtznHzaFwv0nX6SfzIFN1hC1Tj8fusINBCo+iE4XwVltlrCV2e7j93rsRq93jZHynLyfDULdauE= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=mdwykPfQ; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=xVVdiHSy; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 592DNE4V013769; Thu, 2 Oct 2025 16:10:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=corp-2025-04-25; bh=XdSUkQCrNHMkCxPcpk WJKl8mhOPpXIbVSlm8TNARHvw=; b=mdwykPfQu/fKL+VFe1TdJhkxXH/3MXdPWc pY5S+OmRVVS+Jq6ilXJ/ecj27ixZ+Ak7rGwgCBYB728eb76t800WajwG5AIELkYE 7wA3vhZLdiTSQ5sqwqJfXBpRXnaEJtfxO/4ZzqYUTm4x5TNdv/tdOBXdvB8yLIsU HYqEhA4rfUr3B+e993ksScewAtrfRLsdRIGvDwUw/mP1Y+CMyf4LeAemI/A7HmZQ 6X/qdKwIG6h4wAIy+jJwUIigoiMa8IgWTHxevI1Vxh+0zuSP2byf0Z3u3AlkCNjF Howpn4D6ienKbh/QhkiOEcMN2cYF5NSPLsHOOgf8u+i/gIpJtJ5Q== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 49gmacunt1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 02 Oct 2025 16:10:50 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 592F6EUb000387; Thu, 2 Oct 2025 16:10:49 GMT Received: from ph8pr06cu001.outbound.protection.outlook.com (mail-westus3azon11012041.outbound.protection.outlook.com [40.107.209.41]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 49e6ch47rp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 02 Oct 2025 16:10:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KK5kR1QXZeSEA7SWnk//TkAM2OaXVdQ5U6kmAWnYkBrd0vH5i77aUz6ec3Si20VMZA/XQvrOy4SPNEiHQJ1avGV/KXgAnOm/MXFxv4ppDvUfrmz7+zImwrMtPE/3V0FPFbA0ELSY+6nHaLMl7SG7VGgcmXbkjQejPk1b0S9/8eFgY/UqQ8iWkA7/tE4WKCo4pBdWS/e6zp4zs8xkqH9eg9uq7Xe6OkUZhd7w3f+Y+vKZpy7Qq+ZbfmCzaWBPNgFOzWO9fa67Ej5pvfBWrcCgNXpwQAWjm+7N3V3+y96CDhR0HpMbaKnasSmC430ooI7EnBeb8qQ1JZKRCXjKiFpeyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XdSUkQCrNHMkCxPcpkWJKl8mhOPpXIbVSlm8TNARHvw=; b=avq1SvfZkFKRgWoAcoOM0HiNB/MCKxfAuVC6TCIZ3wskaoEmnMA6IUzYBZSX9f/lqW3w56ZI2Gky7+wb9Wex5gH14Kr5nWjz2yP1fcp70l3l/ACK3ncPNdwUt5+UO94qyWucW5j8QLdnuRKmUrV3aX8ddNIrx/5KaK+AGElO1j5FfvjGsyd4xOUGOSZx1AzKZro9SshhhVdThX2lClqZ2MduwFe7qFYoxzgztEEFamP5SD1yCcfSnrEQoWDIVifK048mjIQLgbWgSf9U/WjYaMinEOnZzUkmJSjqCbUyU+DUbg22jaL1n5hhD1/bMH4k6NY2eGRnx0eN20yMH7AdJw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XdSUkQCrNHMkCxPcpkWJKl8mhOPpXIbVSlm8TNARHvw=; b=xVVdiHSymMkSDPQDlz1BBay1uT5u3+M7HgFxCvStW4q0iCAGn31D0F6pVkSKNJ2Bmmz/yYmwycUNvzSJHEsa55VQo0604hxSbU8LMi6gmjzR6AbXK5RZJj4pr9BiPydGQguBzeIFrfmiyUxdF1E0ak/R5C7O1HWTCWiiKh1626g= Received: from PH0PR10MB5777.namprd10.prod.outlook.com (2603:10b6:510:128::16) by SA1PR10MB7635.namprd10.prod.outlook.com (2603:10b6:806:379::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9160.18; Thu, 2 Oct 2025 16:10:44 +0000 Received: from PH0PR10MB5777.namprd10.prod.outlook.com ([fe80::75a8:21cc:f343:f68c]) by PH0PR10MB5777.namprd10.prod.outlook.com ([fe80::75a8:21cc:f343:f68c%7]) with mapi id 15.20.9160.017; Thu, 2 Oct 2025 16:10:44 +0000 Date: Thu, 2 Oct 2025 12:10:40 -0400 From: "Liam R. Howlett" To: Lance Yang Cc: akpm@linux-foundation.org, david@redhat.com, lorenzo.stoakes@oracle.com, peterx@redhat.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com, baohua@kernel.org, ryan.roberts@arm.com, dev.jain@arm.com, npache@redhat.com, riel@surriel.com, vbabka@suse.cz, harry.yoo@oracle.com, jannh@google.com, matthew.brost@intel.com, joshua.hahnjy@gmail.com, rakie.kim@sk.com, byungchul@sk.com, gourry@gourry.net, ying.huang@linux.alibaba.com, apopple@nvidia.com, usamaarif642@gmail.com, yuzhao@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, ioworker0@gmail.com, stable@vger.kernel.org Subject: Re: [PATCH v5 1/1] mm/rmap: fix soft-dirty and uffd-wp bit loss when remapping zero-filled mTHP subpage to shared zeropage Message-ID: Mail-Followup-To: "Liam R. Howlett" , Lance Yang , akpm@linux-foundation.org, david@redhat.com, lorenzo.stoakes@oracle.com, peterx@redhat.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com, baohua@kernel.org, ryan.roberts@arm.com, dev.jain@arm.com, npache@redhat.com, riel@surriel.com, vbabka@suse.cz, harry.yoo@oracle.com, jannh@google.com, matthew.brost@intel.com, joshua.hahnjy@gmail.com, rakie.kim@sk.com, byungchul@sk.com, gourry@gourry.net, ying.huang@linux.alibaba.com, apopple@nvidia.com, usamaarif642@gmail.com, yuzhao@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, ioworker0@gmail.com, stable@vger.kernel.org References: <20250930081040.80926-1-lance.yang@linux.dev> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250930081040.80926-1-lance.yang@linux.dev> User-Agent: NeoMutt/20250510 X-ClientProxiedBy: YT4PR01CA0102.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:d7::26) To PH0PR10MB5777.namprd10.prod.outlook.com (2603:10b6:510:128::16) Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5777:EE_|SA1PR10MB7635:EE_ X-MS-Office365-Filtering-Correlation-Id: 50cf1bcb-11c1-4557-60bb-08de01ce3ddf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|366016|1800799024|7053199007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?tZjhHpDqzLdQFN+CWp/pSVSmJ6/q+u21GxqgIesbdCLxZu/OpdUMY+IXVvx5?= =?us-ascii?Q?vKfuPcDLBT/CWuV6OvxpbHs6YBntNBuyDyIXg4FFDedDq/UCotdGEAxN2971?= =?us-ascii?Q?AYLKN0reqTNIvAs/RAMmLf0vilb+FfO4mijXzWGrTgisz5jczh6CoSbk1jse?= =?us-ascii?Q?KtcnyCBqP5oKK+yxAjD8hAEDkRkBsJYN+WQUyMQ6UmRpOqeWy+sOBgZNxhX4?= =?us-ascii?Q?5Sg3/U+YZRoWVObY3IqbRABYw83HlxLc5uhf0jRbdk++/n24pJkWlPILfZ13?= =?us-ascii?Q?XpQtg8+7fzAvlqusr2wGDIcnC5nUJHWRHkI7Fp2coPTOblMW5Fa/ONVWIY65?= =?us-ascii?Q?9lSELRlgOjiC2GFUYhPXeGaFLqCy/JQKR8r0FYljiUktPyuaddYtJloKYql4?= =?us-ascii?Q?sbHVbMt1XSoHtemhern8ku5Dxv7s+bixVufyi/Z9yuZj550/6LRQKUxhUg1R?= =?us-ascii?Q?+MpPS3iAOCf8zKauUjiOLiVv8GrT9i+qCkfe6KTm2BDRvwmllGqEHjAo+FvE?= =?us-ascii?Q?6YQnPs4QAAlpAhezA08jEn2cHsu8D6pBW5DSQBvU49iqrYCDMS2ND+mL1VoU?= =?us-ascii?Q?Jr8u2mgKH/1r4ullw0rW9Itw6nFiyS41J34gN9e62ZJ9aBZ7M3xdShsO+6c7?= =?us-ascii?Q?a4sPLfqwLPNih0nTr4mweThuSJT9isj49P/QTq/tfxi8RRdJUip6Ds/R4b2J?= =?us-ascii?Q?G4eWD8EskKfEA5eYhNyw7W8U3C2Ycgr3yyyBl5xQwVBUXCJzZvH3zCa3/zK2?= =?us-ascii?Q?0znyjTVOAIGSdZUaRqlsPW0P2Ybjog/hUG5DBKRmkPZnj2Q78IGwHpo+OzSk?= =?us-ascii?Q?AuAJgHHVu33hTpsbjZyIiK/69fdAAF+1UJ5Dd6RuCQzfFSOz37wLlLzTRzVt?= =?us-ascii?Q?KCmjaF5mq1QxoPhgYSquANnZfFz4nNHgVuj4RD7ZGIugbwRP6X+QO/HOczxQ?= =?us-ascii?Q?GgTKV5dhwWEdf36SOz2287mx9TQXAgO2TjKVemhrIF3O7ReMreeOWKmWx7ak?= =?us-ascii?Q?NuouoUUmoic/m/974Ev9Hnscgf6XdHY/v6Ny7QetC8r2Z5qrIoHDxuyJCTZp?= =?us-ascii?Q?mqbvZV/09KcbUuRvhiaSm800iREXmwg0xWf0kW8rQJmP9MkREetY3pZrMDaN?= =?us-ascii?Q?YBj1Q/J2S+0VdpQ59iqVF/AwndVN+2icNAGlX/7L7ri11AUkFnoJR9Bo91Me?= =?us-ascii?Q?PPye+uJjinYc8w4BwRkL2lJclEBHxEsUsLXNFj+U1UAS6AkQeBWVT1Cd4a0N?= =?us-ascii?Q?3dqM40qyAFuRxd54NXEjin8ormxo3CF5Yjv37/DrmFsynDKfzJjWboumD2KW?= =?us-ascii?Q?yg8OoXBrRMqRnhju+zo2UF19Y/lmf9zs8sZN7DR28I+rcQB9goRDfKoQotmg?= =?us-ascii?Q?4LJLnmGuQo9S3xbJS+pUF4mvab+TMrB/iZ77A033/3wm5R+xWA=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5777.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(376014)(366016)(1800799024)(7053199007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?QAddrMc1xUvcN8pLzjynwqqizlnZ0rqISdobk8R2fhXRzyeOR7Evq1JxdtN/?= =?us-ascii?Q?MOpUgoe04Nuw5mUqMH1eNyqYpP+I8+hqRXc9tkzXE220CFjWLOQk3N/woetb?= =?us-ascii?Q?MQuhcB5VNx2I49fgIluUet/EN1ddpjnSsuauOqjHtKY74SDIAa+CNiAGG69q?= =?us-ascii?Q?+657u+TeS7P9vsWrRxYLncmHuPGPgytAo1O2xg9Yih2JOc6BSb3xOlFd7DdZ?= =?us-ascii?Q?RXo7sanWeFVvmoe/pFzxUsBkXp4O7xBoFJL7Mu53YbefJhGnB5G9H8iCRT+Y?= =?us-ascii?Q?KQ++zQntBt717XfLOByhu8Rn8X/Q4P7PGsjv1gG251qIQbHEqaGGbYfNvxo7?= =?us-ascii?Q?60q4sQuhyyapBuqir6kozzgzdR1XENJHJpSVUKwDaXT3cpkTrcYwjDd9SomS?= =?us-ascii?Q?6SKZU6bz+GnY9uI+VcdZ0TLmcz1jRZIkh0Uwgyg9cC0L2Vcsam0nyUbsrCYt?= =?us-ascii?Q?AnNqSAYPpqhZXMpi26ME9PHmgFkaTByONPIrdvEUAeaxT7Oyx+nd3iY3IbpT?= =?us-ascii?Q?DnioS7b3AZnw5mrm0SdveMDaTiT+m+8SLxp9JYSaxbOKXuUHuiqoYm54s6fV?= =?us-ascii?Q?L9VADOfwMMRjp+klur/NV0lWkkimaxnt3au14Poo+YklK4CZ05HmN5RYkfMS?= =?us-ascii?Q?Ey1/FebpNAb0gwGDWCXfRHtRZT93BGzWrk/W7/qO8Wq5sZsNSs3U5H03MJQa?= =?us-ascii?Q?kADfmueA3qwTDauk96RVTuMUuQ+DoKOVR8qHCk/rUrbzzCaqUmiR6spjJByj?= =?us-ascii?Q?7Lk+U7K3YNUBYgJKkJEmEQnDBfIVHl2AbZ8ChUpTyy5hPprct6t04bGM/QBW?= =?us-ascii?Q?4o5Z314dDbZsI8D+iy7w84rfipwRL/DtKqtPJypD7LABtiN7JOJSjjlpyILd?= =?us-ascii?Q?ufqWC4HfM20ptKBLwmMN3kvLA46aGWjQsX6ps69aKi2sD7WXETpVNyU89BHm?= =?us-ascii?Q?fYzzFof9CDlvbY7ULJHJyuCBIn/jwGl+s6X1iX1BVrfqCBMOXsrER9hUq/Hi?= =?us-ascii?Q?2XJEHUID0jwBV+mVxZkxI5PPrKWX1S/cEZ7VUB7kocyFewMq1lQMyOYbs9EG?= =?us-ascii?Q?GliWYPUkMBsfJElyGlJ8FN+PD5yrTSw78k5viUfUa4J97XIi5LfdvmAeKWjY?= =?us-ascii?Q?fEAqPx33hHbdbj79KerEwXMJvAZr2Q6FExHlu+NWPS1//8Z3qPgwxtc217CW?= =?us-ascii?Q?zYFBSeUns/EwYf2kcdLVnFPL6678fc2Cne7NHpkIys3+Jh2qL35n99IMnkZV?= =?us-ascii?Q?4107g5+A3lJ8WcFrFcI0kg0rLwm+IkHbxthZDEiFed33vdsBBWmj0TmCQYlN?= =?us-ascii?Q?AiFqJiTq7PDrrCBpZ1xEUd9rhiGtOveBME6YkZKQcq+SwRau2BjWIv3u4xsv?= =?us-ascii?Q?kb2UE4fH1UaZW72yNKsv6v+fuwU5i30Cu43Zf+M33FxxqsazXyPEBOd4iD4F?= =?us-ascii?Q?9SYnrRQ2AzpYhWCj6DdMlTEISiem2VyrXHRxdhh7228eYGUGOrBb5oItvMZs?= =?us-ascii?Q?8HL4R1aKpCWwL3KqZ9Ar/yw9lNGScAQugSrZa3aYOUd6ES1q27xi+in5oddM?= =?us-ascii?Q?nPPziVZ1rTHhtPbVQpGIL0HY2ypge96TCMAhVl80?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: RZFS4dvAWM4lz9YNjox/8x41C/5X/VwrV9xfACmKtAr92pEYOJxMliVpP8j/i1UhDqW//P7i8JxkS6JLpb6mrmHjmimWE2G1RQHFgVgduEffSa84K5uUI9Wa38MarM1K7VGmBBhG73dj6c7tLST/wrMhOGzfP/r8zISSTefdA5sjjIQ/o8Eaz+wI1pbOItbehLXfhU8UdtgdSQ2g/zc5icuXjf18CZ9yC+04nqSqU4QMd5TEPjE7fnngQByEfxUKTHeUl5e+xYy36iGMEylOfSk+hTld8RoeUcn1aQksUds2AW1abF1VzdErfMxWU4WjH+vzpI3v6WpGOK5BDOX4RsnB2S2ZkfNAr2Jc4Htt9U1e5j3mgYTRgbFg7tcZ0DT6mLQWgpdEqxf++v9IxqM59+iURCU2I0QOaGNWaCHirqJD7c28BOoPSiP1ksMFyU6Lk3LtNGUj6KFfXi/Qo4WafSCARX0XlNNkcr2x4w2ySwxXkws/Y7Jj+2+VLLHoJ0K1WXWP7EesIuTAG75Th4jJoaZhlwQgQJdCi1pPo4sPgRTAUjLM5sHO5LNLAxDUxYWKKNVPijjhHu9fzllVTOmhGmN+pPFuZ5vyugVShUD7TLw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50cf1bcb-11c1-4557-60bb-08de01ce3ddf X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5777.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2025 16:10:44.8229 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: pWkVyq5fClLO6A7c2+Gb35Qdm69N2uMo46Bhj4XK8A9v2O5DA6KVlDnkDv7ksw4PYo9+whZ8KDWM3RCEvoo3UQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB7635 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-02_06,2025-10-02_03,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=996 phishscore=0 mlxscore=0 suspectscore=0 adultscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2509150000 definitions=main-2510020137 X-Authority-Analysis: v=2.4 cv=P5I3RyAu c=1 sm=1 tr=0 ts=68dea40a b=1 cx=c_pps a=zPCbziy225d3KhSqZt3L1A==:117 a=zPCbziy225d3KhSqZt3L1A==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=x6icFKpwvdMA:10 a=GoEa3M9JfhUA:10 a=VwQbUJbxAAAA:8 a=20KFwNOVAAAA:8 a=7CQSdrXTAAAA:8 a=yPCof4ZbAAAA:8 a=32i-lLLermmMPTXH56IA:9 a=CjuIK1q_8ugA:10 a=a-qgeE7W1pNrGK8U0ZQC:22 cc=ntf awl=host:12089 X-Proofpoint-ORIG-GUID: GU_FgiTpJr1mI3UannlYLWSbYX4kNY9e X-Proofpoint-GUID: GU_FgiTpJr1mI3UannlYLWSbYX4kNY9e X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTMwMDE2NSBTYWx0ZWRfXxbUFVzCyxUF3 28BmdK5ctmOy9pGANxsdP7Aa25pBBY/iInscKUF4T0jRcXh9K6qFJzujJYV8IJ5jDZGeTY5l7Ja 3+0f+/W5ujpXtxhzi8fnEAroeaKjZhmnS0oR9jqxF2DZGSDHSOjrtYbJkMTvAznaQfGFjzxJP4Z Jlfp3T47/kTJEuc3FLBC1yYbMgMeNqDEsz3EBk0DYhwa3iEqOYTsGw6lr45mjwitD6cfKtl4qNA FmVeXy5Nc8ngFpggGrT/PiqHqew9nqegMtHJze4DRspANtI/TPHvuS+SIWzfmeTmMAi0Bq19JVr vlzc66Akjy2BjzH1ZZfKHyOJBAuNsQ6191dDi5mZ8sotXN39GNYWBhuS26LHK/vKqWaBNru+RrD vRAy8JA5Q1ZjPaW6cS1+OZZhpsIJdPAlj5SVoEeAbrLp4CnNa5Q= X-DKIM: signer='oracle.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-DKIM: signer='oracle.onmicrosoft.com' status='pass' reason='' X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.199.223 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.199.223 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.199.223 listed in bl.score.senderscore.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 * Lance Yang [250930 04:13]: > From: Lance Yang > > When splitting an mTHP and replacing a zero-filled subpage with the shared > zeropage, try_to_map_unused_to_zeropage() currently drops several important > PTE bits. > > For userspace tools like CRIU, which rely on the soft-dirty mechanism for > incremental snapshots, losing the soft-dirty bit means modified pages are > missed, leading to inconsistent memory state after restore. > > As pointed out by David, the more critical uffd-wp bit is also dropped. > This breaks the userfaultfd write-protection mechanism, causing writes > to be silently missed by monitoring applications, which can lead to data > corruption. > > Preserve both the soft-dirty and uffd-wp bits from the old PTE when > creating the new zeropage mapping to ensure they are correctly tracked. > > Cc: > Fixes: b1f202060afe ("mm: remap unused subpages to shared zeropage when splitting isolated thp") > Suggested-by: David Hildenbrand > Suggested-by: Dev Jain > Acked-by: David Hildenbrand > Reviewed-by: Dev Jain > Signed-off-by: Lance Yang Reviewed-by: Liam R. Howlett > --- > v4 -> v5: > - Move ptep_get() call after the !pvmw.pte check, which handles PMD-mapped > THP migration entries. > - https://lore.kernel.org/linux-mm/20250930071053.36158-1-lance.yang@linux.dev/ > > v3 -> v4: > - Minor formatting tweak in try_to_map_unused_to_zeropage() function > signature (per David and Dev) > - Collect Reviewed-by from Dev - thanks! > - https://lore.kernel.org/linux-mm/20250930060557.85133-1-lance.yang@linux.dev/ > > v2 -> v3: > - ptep_get() gets called only once per iteration (per Dev) > - https://lore.kernel.org/linux-mm/20250930043351.34927-1-lance.yang@linux.dev/ > > v1 -> v2: > - Avoid calling ptep_get() multiple times (per Dev) > - Double-check the uffd-wp bit (per David) > - Collect Acked-by from David - thanks! > - https://lore.kernel.org/linux-mm/20250928044855.76359-1-lance.yang@linux.dev/ > > mm/migrate.c | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/mm/migrate.c b/mm/migrate.c > index ce83c2c3c287..e3065c9edb55 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -296,8 +296,7 @@ bool isolate_folio_to_list(struct folio *folio, struct list_head *list) > } > > static bool try_to_map_unused_to_zeropage(struct page_vma_mapped_walk *pvmw, > - struct folio *folio, > - unsigned long idx) > + struct folio *folio, pte_t old_pte, unsigned long idx) > { > struct page *page = folio_page(folio, idx); > pte_t newpte; > @@ -306,7 +305,7 @@ static bool try_to_map_unused_to_zeropage(struct page_vma_mapped_walk *pvmw, > return false; > VM_BUG_ON_PAGE(!PageAnon(page), page); > VM_BUG_ON_PAGE(!PageLocked(page), page); > - VM_BUG_ON_PAGE(pte_present(ptep_get(pvmw->pte)), page); > + VM_BUG_ON_PAGE(pte_present(old_pte), page); > > if (folio_test_mlocked(folio) || (pvmw->vma->vm_flags & VM_LOCKED) || > mm_forbids_zeropage(pvmw->vma->vm_mm)) > @@ -322,6 +321,12 @@ static bool try_to_map_unused_to_zeropage(struct page_vma_mapped_walk *pvmw, > > newpte = pte_mkspecial(pfn_pte(my_zero_pfn(pvmw->address), > pvmw->vma->vm_page_prot)); > + > + if (pte_swp_soft_dirty(old_pte)) > + newpte = pte_mksoft_dirty(newpte); > + if (pte_swp_uffd_wp(old_pte)) > + newpte = pte_mkuffd_wp(newpte); > + > set_pte_at(pvmw->vma->vm_mm, pvmw->address, pvmw->pte, newpte); > > dec_mm_counter(pvmw->vma->vm_mm, mm_counter(folio)); > @@ -364,13 +369,13 @@ static bool remove_migration_pte(struct folio *folio, > continue; > } > #endif > + old_pte = ptep_get(pvmw.pte); > if (rmap_walk_arg->map_unused_to_zeropage && > - try_to_map_unused_to_zeropage(&pvmw, folio, idx)) > + try_to_map_unused_to_zeropage(&pvmw, folio, old_pte, idx)) > continue; > > folio_get(folio); > pte = mk_pte(new, READ_ONCE(vma->vm_page_prot)); > - old_pte = ptep_get(pvmw.pte); > > entry = pte_to_swp_entry(old_pte); > if (!is_migration_entry_young(entry)) > -- > 2.49.0 > > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id gHjWNevS3WjCJwsAYBR5ng (envelope-from ) for ; Thu, 02 Oct 2025 01:18:35 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Thu, 02 Oct 2025 01:18:35 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v47xr-000000035iS-2Tbz for hi@josie.lol; Thu, 02 Oct 2025 01:18:35 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A9DA43AF7C5 for ; Thu, 2 Oct 2025 01:16:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 45A5838DD3; Thu, 2 Oct 2025 01:15:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="hBddSyhO"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="KAAOAY6d" X-Original-To: stable@vger.kernel.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (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 6B055632; Thu, 2 Oct 2025 01:15:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759367747; cv=fail; b=erauRosntaVyWqCVsIavE+dQovaMyL8sLm8A+zdJNbTEN/a4DVlFCSJT+3fMAP7vt2ZhE8Jx5Vbv3vuoq8p3usMdymkjiZWONAM6Pp1eH6H5F2ECJl7nAPgR2fIR6KQhsIpU2mE2sHHzO0MkTeB9RtMgGkpElN7Dem+a/FbfL+g= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759367747; c=relaxed/simple; bh=mKnWmBzMJX2Iq9+DwL/JNaaBROqiIkgDBJaM4uq8tKc=; h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=jQoizYF2b8Fej6GmltvTi0p0RW0p/Qakf4PuvKNxAqNEfQzeqIyYtGg/eFJFC2rgzVy5fRN4GKirnVDXSdS6lqPjME1oJVOR6y4wwap+MoGdNgBUwmz+UXnCCq6pTKun8SeFYdctQdTTI5/q6mb7D45yPkDH/pOAPSnJG4wTb4c= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=hBddSyhO; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=KAAOAY6d; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 591Lg3cW016404; Thu, 2 Oct 2025 01:15:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=corp-2025-04-25; bh=wkrTV8MDIYvmnKrgkZ Q0xBaYKJw74WFrfzWQ/F980+s=; b=hBddSyhOxeYvc8OaDqCGVYc+jiZvoWQRpM mjHcCcV5Q4YgfUA4Oyb+t8jFcxrCFGwxEphnaNPsqQfYrFbZawsufB8U1iNswji3 019TAvI7p8qHx+m8UB56RXFWercI+p6QTERTzVS7nca9UGcVNhoBBALMeZ4Xk2Zn n+IcvogUXH+5RMCoUoDGF199ZL2mLGnX/gltHs0aHv2KJM+RsHxK7BI5Jfmwncwj PqhbBApZqFRIGhdDOsj/ri35UTz/qs/mrshpc09Zly1mK//T26xr/KlUM3jCf+oE g4+zhH79Ip8pxuUGSjeQ8xp6YLfWZa8pdzykXsZkqYdiNOQ9MYvw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 49gm3bjkb3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 02 Oct 2025 01:15:11 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 59204RlH000349; Thu, 2 Oct 2025 01:15:10 GMT Received: from sa9pr02cu001.outbound.protection.outlook.com (mail-southcentralusazon11013000.outbound.protection.outlook.com [40.93.196.0]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 49e6cgdh8f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 02 Oct 2025 01:15:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=m/ZmGVvC3g30Nf0o2ruLARes9SEdngxtRqwUZom7kwzi5J98xZktEvXsly0fJuMmYGbaLq3mey5GLuhJrrI+22Z+JWbxih1hW4nJXmkd+MpuT2054LVgySMVDSvvJuslpC91vn4UGwEfk+PUeAG0RGAaqMw7MU/TE1qci3uCsDjky1o6B4rIoa9cVRnz15X2OuDIvWdi6NO2OQv0BnW0vR52CNw+g0wlZUjAsuN/U0NQbGuCM8NNPGjCQA4ObNjdnq5kww89SMwvALPKl8ekCWqQU6oS2wxdRffbSkIZKu3+vB2Be+Q2jm4AN1AC6jYvbK47NL47qpa9RxQKcNC0Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wkrTV8MDIYvmnKrgkZQ0xBaYKJw74WFrfzWQ/F980+s=; b=vW51t0LxR+sgTsZRC5jP+Y1rLB84bJn/XTasm8fYp3d6Qbno23Aw++h9PPSw5oMcvEumAw0+Scg8L+/w7wAi9HwXs+btizXPrkBnt+rWNyaOLeDQ0+HS7ebAjF36fXcY+7iYdHRMxpXGktTJ8ZaKyiGrrIg/OT7R1Axy9kSkrWqS4flYUZ3C1GLsoYGzTkF0woCBl80yt1Mp7mnIX0i7IXhgyIYOeKfQkG2X+c5IQ64S8sAi91yDg9NJBex6HPMvRVPgJHukUSN5kg0d9rzyFiFU1sLkCKV1ttqwAkq0gRA3mv94tusuz/fELYuuXJr4TLHhR6DcP44aWaZwEqSiBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wkrTV8MDIYvmnKrgkZQ0xBaYKJw74WFrfzWQ/F980+s=; b=KAAOAY6d4FeTMeWkg9JEXpJGce/Vbka20FO5vE3OALmSfdqXOpVZSHLlf3NTk98d7p6xZPoo8DiN0d6U8/PWsDHN0uzPevivL09kSnjoAZ7ut4mHM7SaD+L15Ya44Eeu81Xkn5CyelTkeuPnyiwopDeqcN4vEQ01GTUWHupI+Cg= Received: from CH3PR10MB7329.namprd10.prod.outlook.com (2603:10b6:610:12c::16) by CY8PR10MB6612.namprd10.prod.outlook.com (2603:10b6:930:54::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9160.17; Thu, 2 Oct 2025 01:15:07 +0000 Received: from CH3PR10MB7329.namprd10.prod.outlook.com ([fe80::f238:6143:104c:da23]) by CH3PR10MB7329.namprd10.prod.outlook.com ([fe80::f238:6143:104c:da23%7]) with mapi id 15.20.9160.017; Thu, 2 Oct 2025 01:15:06 +0000 Date: Thu, 2 Oct 2025 10:14:54 +0900 From: Harry Yoo To: Lance Yang Cc: akpm@linux-foundation.org, david@redhat.com, lorenzo.stoakes@oracle.com, peterx@redhat.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com, baohua@kernel.org, ryan.roberts@arm.com, dev.jain@arm.com, npache@redhat.com, riel@surriel.com, Liam.Howlett@oracle.com, vbabka@suse.cz, jannh@google.com, matthew.brost@intel.com, joshua.hahnjy@gmail.com, rakie.kim@sk.com, byungchul@sk.com, gourry@gourry.net, ying.huang@linux.alibaba.com, apopple@nvidia.com, usamaarif642@gmail.com, yuzhao@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, ioworker0@gmail.com, stable@vger.kernel.org Subject: Re: [PATCH v5 1/1] mm/rmap: fix soft-dirty and uffd-wp bit loss when remapping zero-filled mTHP subpage to shared zeropage Message-ID: References: <20250930081040.80926-1-lance.yang@linux.dev> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250930081040.80926-1-lance.yang@linux.dev> X-ClientProxiedBy: SE2P216CA0193.KORP216.PROD.OUTLOOK.COM (2603:1096:101:2c5::17) To CH3PR10MB7329.namprd10.prod.outlook.com (2603:10b6:610:12c::16) Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR10MB7329:EE_|CY8PR10MB6612:EE_ X-MS-Office365-Filtering-Correlation-Id: e9a5b411-ebb4-4dfd-e3bb-08de01511f77 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|1800799024|7053199007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?WvkcDUrgeJ5AvH2gpMbbuGszbEqjofhVGyhmmNIOzaPsfsiinr1B5BXg2pEm?= =?us-ascii?Q?Pp4TsXzkw9RGQbJhrNEpzB3QtrqYGVMNbV3/SSnchxqKcESdDFv0l5jWpWvN?= =?us-ascii?Q?G54AUhGlnJpjh7KhOo8R06Oi241E64rlee5nT3GXZXAL4HFJyDDvzZGWXPCQ?= =?us-ascii?Q?l7ttvLyUEWpSND/jHWlmxb5GIASlPe3Y3xVF3MGJ+qlvCAT4AUVC2d4D/Y+i?= =?us-ascii?Q?nF5vezTFhNaA4fSFBl6rop25MzumUvHyxVvXj7UV42GAhujOmb5G6hK2Ft2Q?= =?us-ascii?Q?OfSjS8nmX5vFZdrm1LE4MvcF5offuxMdxKMdBSOB+97Xb/9y3LeVRvwAPjuJ?= =?us-ascii?Q?Fy+GNXq8RO40U5LAEBXBaGuv50HHJnYXo0BBFv5VZQlT+Zl3wSmO71c8AQ8o?= =?us-ascii?Q?9DIgdiXscfDwhlV8maQ0s0cUy/b8mypmKg6GAj7zOSRKKOGZylMWlZYElDWd?= =?us-ascii?Q?B24cpIAeBiE0QZABisBRX701uWDlRSSOF+jWaEx+nNOUAjgL4k1ckvMjcjt0?= =?us-ascii?Q?1czda5c3HeDm9jtJIimctmUClAOiRFennaXhEgKrjeJ6rbeRHBlxJlPBi+sF?= =?us-ascii?Q?biGloeBsf/sfScdD7KsLJVArX37BsWkCiBWnVj7ZC07NDGLf4fTN85250xE7?= =?us-ascii?Q?BBJvaLhOkIUT5OHUU9z6mzmC1syDyxdWD/8KAAji2m/k4+fxMW1lfqXKnhqt?= =?us-ascii?Q?P65sJL4EsQl1wvnEnYMCK7K/Y2sNBE/c7OJPkiZhRq2ewDfi+WwnWGZ+oBMC?= =?us-ascii?Q?7TZ4dtrLjLXBlH9s91552RcS/JIfDxWxDGKqhbYYiTIaFvioEZf0WDm//uLI?= =?us-ascii?Q?ZqzpmTKAbwMOnj4Llwy+7beAZzruHo9LVR12/qSG/z5NER76PVS/IDkYVZM2?= =?us-ascii?Q?WibnaCJ9Yy9kjqWNeQ8GywbCbR+4LoglFU6CptRHUoWrcyrAVJvNc6BCyY+e?= =?us-ascii?Q?U3tlkuZHw5eWntIIPFjELhbrZlhsi+jChDuDI+Yp8WscfjxM5jVMDpC6oKvj?= =?us-ascii?Q?TCIhcFjzmQscaVg++TAiv76EoUtff54qJMW/GhH7vzjxwfSqRNGqHdeJEP+R?= =?us-ascii?Q?rRxBH1wbOdzdHgxr7r0XpZ+6MWGJHCUHNVTaGlFoT8Na0f4l2qIchx+EhHPy?= =?us-ascii?Q?W8osIx6ScnUf/SXdSxc9pFx+MDafdgpCyKGGaCmzsxFitDh47dCgWtUu7HgR?= =?us-ascii?Q?1tSxr97u2fKwcgsBRuoAk4+vUsZmm9swofJhXn4riN586xyT+wTDe4Lu5DzB?= =?us-ascii?Q?NbL4i+btNO7jBcge4e/1wc/aF+F/+YcpuaiB4fZ15TLSFOJ7JaAmmtDDXAeB?= =?us-ascii?Q?tolAm0Fq9uqPYGx5sNg8jQYZfdhiJkswEURCEjG/FgBGV1MQNugr3Kh8j/Nx?= =?us-ascii?Q?N7GCyf0QthCyUYuihXkYlrhr8OVGKC0UywCglvSiXXFDzXN3qH/F4SYexX+x?= =?us-ascii?Q?GcoYrcf2aqLy/joAQVpqBz/aXzT4+U1a?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH3PR10MB7329.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(1800799024)(7053199007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?/1/c2sgy97Nn7aitIEUj8tSpu/aoFf3j/SUjmEBbk/5Eu9O7hN+HoPL2Q2O2?= =?us-ascii?Q?LnIQ/hrpjLs11JuyNJ3jzyH8wlAFhimXvOA2Sx73OHpE9lDPVsZwFrX9qKY5?= =?us-ascii?Q?eaTmas6KQVkja6UF66Kp3psu/EqStb65JkqY0yr2G2/2+AiCg5X6r9IerzAx?= =?us-ascii?Q?FaGxKgpaNaEXkTnOgzYBw3uIQ6CooGKa50zyTWD/xibQT4We7jvnpe9uLfgm?= =?us-ascii?Q?bS6lSANlsVw7q//W+ne3V55SMPxW1RaTmnB9K/5TC6kPCr/giArx4+3Eatjl?= =?us-ascii?Q?sUPAJe+nahPcmDtvFtZUUsBNTVdIZ6sLq1Cimc+rlivtR0SR24+Ht9ej+t/f?= =?us-ascii?Q?K+LRbPJHQk15wdJs4koNE76MC7ODkbPXSfupP+KshjYpKjhtHo4loJhWGicN?= =?us-ascii?Q?HY2p/WP2ibpPkrZUhe7FZDWkRjOFnzRK8NsVR4AODR+7YNZWIufiwj06hnDy?= =?us-ascii?Q?m3nWjH0+nFJT3cVMb3BJogM6O8lYFxoHnYVdDHmsu5zldsNxx8PH7kNm4Sz/?= =?us-ascii?Q?9ssgT0iaaCDF+1fmaMUBljXv+lEsKNDAWbGntX2Pa+OV2FBCrFfQcFud5bNj?= =?us-ascii?Q?dwwqQQTGNxqjwIJ282hIxN7bT5y5nbAtl7pG/lnfVShIGzPrXGblB8GegqzQ?= =?us-ascii?Q?eUcQ6zr5TxQiFaMy/SHEy3YEmpt5SLIqlpmgOCpy550sSChuAOm8nBhCMWlx?= =?us-ascii?Q?3KABm1ws714l+tqvEmR7oT03F7mJapgAc4B7yXXFsoTC9MG47wMVPPdCTBmZ?= =?us-ascii?Q?cqEgf6rkYlVPF/ix/FF9xZ5wrX+HU/GytaI45fN/PsEvHdYA0WwwyMblezKT?= =?us-ascii?Q?NvkxojMQ12EvRHDAltF7PLu+z3jKotIvU/mqW6PMNGfMLuw7cu7cl3+MiPWx?= =?us-ascii?Q?6OjlgDF+GRXV55LAqn1OS+vmGHxWlgOtXVT78rnPkOtPPLPPTWXqAYx50XTK?= =?us-ascii?Q?SfJOoGX+xRet7s+gFZSKfJuQtPGemxEvESNdH3JLpzwDBEzPm6LFHzfpHzuL?= =?us-ascii?Q?8vn+YB3UIEe0gQ0qzBNc5L/eMqpknvy3+aCuN//no8vzVGdBmBM3/bxdWVd6?= =?us-ascii?Q?AEbENzFsloPOnkkxLd9h2F6URNAaFPmN06oSr843OCY6tnOw3tBHtuEanU9M?= =?us-ascii?Q?8+AnvRPN9lx/0IaT5ebD9oMuN8PDkMJaQjz10wBpf9Rmz8jvUpsyPBVh5nkf?= =?us-ascii?Q?e1QHH+9Pu0GAasoqMAja488URM6vW5UqRFImG68y74BB9o3/cDKyrvm4Dmmq?= =?us-ascii?Q?hFSyYoovI82v1iyy8LRzHpYwnoWYICKOoPtvOhJ7I6k1NHTOmNdHsSHK9gcU?= =?us-ascii?Q?dHTq1mQznqWf5qcCzgEVMkKQ/yjb4TqqO74sjpT9C2vgIXpo6mE5kNXZLvCb?= =?us-ascii?Q?rEqUO0ZVWVcazrbXSHtY/2Rj+zBw+L/gU+qFknnbx7jCM7LwxU4Zz5yngNpv?= =?us-ascii?Q?AgRIpj6hNF4YN61Q3n4t+j+dj0Shzq4ImwdubOKWt9LcmgB+iGGLWyWPKBNK?= =?us-ascii?Q?Z7m97Uadsa+h1jU24ArRJYaC1h6O2ftXpTEV0DoHODnmsrxOayh3u5HPWQIw?= =?us-ascii?Q?lPdgS5wSE8Awu6whCVfz11j5mWLIrVMmAQ1OoE2/?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: BEfT2VwM55XGwYO46Gft8mdhrkb+UWkwA8st5yhMrnDvdM9qzKeuonwwv+aAC/BlE0pYHO5H1hXhPSye4tSssbr0dz1i0ub7cyQSWnwFpnr/xCrAdSkiQWCnjDwp0WPHZUnnTttB66sgPzaYdUainrVv14zM9d2IwVmmRX4KV1WDFvJBCb16zAtU8ftM+XsNkjzlJ9hDjjM/luZHdVCiruLXdUfkiznLz4qzVgX4RCqXZDo9AQn3utGZFLJuingZCooMENpKbgagGN+zBsdfb0v+l0oObqbAqShWc/j4JncGfoTWMoF3IGYNJukJ5AXL5J8SyGrciTjzefCcYtnTEnhlnLJ1IB5xA3xQYdyOybAnhxpcpVRIrLFVjo3IyHrJDuP1cTUjKMWNvq71pD0tps7MRXbIfXRQOZ6ACaBk5W1bd6ZpVqhnTzvjHgvb4lo4QvY5zO/u1KP80tEx14QiXz4pHEJizpx5RHQGYLvInvi2acNs/CKxGJ55Zd8qvEnBXvFVycna3ev/CQaLZXd8xI2Iwt5OMs4ALznfLe0aFtvLKxFzUFk3dcqAB/+9kGIkCw002k9QbGcYioCOf4ggaWEajS06i55X6a9JPDipJz4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e9a5b411-ebb4-4dfd-e3bb-08de01511f77 X-MS-Exchange-CrossTenant-AuthSource: CH3PR10MB7329.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2025 01:15:06.7867 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NmdLomi7iTt8C/zLw4qIFvXCN///CVt2sT/3X8PA+jmtBFHu0gr/WElcENfwERHXcyDk9WzVNUaSTZ1BuR0IOQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB6612 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1117,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-01_07,2025-09-29_04,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=754 phishscore=0 mlxscore=0 suspectscore=0 adultscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2509150000 definitions=main-2510020009 X-Proofpoint-GUID: -wegKgRID_kNnutkTgAU_qJpPOYbqu0V X-Authority-Analysis: v=2.4 cv=GsJPO01C c=1 sm=1 tr=0 ts=68ddd21f b=1 cx=c_pps a=zPCbziy225d3KhSqZt3L1A==:117 a=zPCbziy225d3KhSqZt3L1A==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=x6icFKpwvdMA:10 a=GoEa3M9JfhUA:10 a=VwQbUJbxAAAA:8 a=20KFwNOVAAAA:8 a=7CQSdrXTAAAA:8 a=yPCof4ZbAAAA:8 a=bqQlsaOvPmgy4kHRsZoA:9 a=CjuIK1q_8ugA:10 a=a-qgeE7W1pNrGK8U0ZQC:22 cc=ntf awl=host:12089 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTMwMDE2MiBTYWx0ZWRfX0Sv9uTvFfIrl s0CZyeks1ZfcObgaB6mHZPDAeZ5zJJLufOXqJbAbktgJbaknxh2LkkvnGBIFWrKqxu1noKpxOWa xm267yeDKzZYE0hqCbTlJqdzob4Oc4RvgqX7VD076nKaJMYgVu/iFrycWUMIW6cfc+Sl7N2EOJN t4QgLHybVYWcWyr+5R7hZ/hR6P8529vRO5AjYV14ail7XKgViUKZdRuwL6KCSXeOCX/rrKFGC24 7SYrv1ZUwvqPcIOupRhyflFZ8GLZz5uy7ja0pAOydu0P9eXAVkgZXyCXNqvLoEcro79cQ4jfaBi EKkPXZ5KKGfGuRNw/qm9RoFsF1aytKSuRHvfwyn3PasyOsBZHJITNiEnYkpVFxt0/TayfM4b9vt TmIa5JhLcdN+3YxeXbOPmw4UekRMFKgdaaX2bXWcVy9bhamRz50= X-Proofpoint-ORIG-GUID: -wegKgRID_kNnutkTgAU_qJpPOYbqu0V X-DKIM: signer='oracle.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-DKIM: signer='oracle.onmicrosoft.com' status='pass' reason='' X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.178.88.99 listed in sa-trusted.bondedsender.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.178.88.99 listed in bl.score.senderscore.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On Tue, Sep 30, 2025 at 04:10:40PM +0800, Lance Yang wrote: > From: Lance Yang > > When splitting an mTHP and replacing a zero-filled subpage with the shared > zeropage, try_to_map_unused_to_zeropage() currently drops several important > PTE bits. > > For userspace tools like CRIU, which rely on the soft-dirty mechanism for > incremental snapshots, losing the soft-dirty bit means modified pages are > missed, leading to inconsistent memory state after restore. > > As pointed out by David, the more critical uffd-wp bit is also dropped. > This breaks the userfaultfd write-protection mechanism, causing writes > to be silently missed by monitoring applications, which can lead to data > corruption. > > Preserve both the soft-dirty and uffd-wp bits from the old PTE when > creating the new zeropage mapping to ensure they are correctly tracked. > > Cc: > Fixes: b1f202060afe ("mm: remap unused subpages to shared zeropage when splitting isolated thp") > Suggested-by: David Hildenbrand > Suggested-by: Dev Jain > Acked-by: David Hildenbrand > Reviewed-by: Dev Jain > Signed-off-by: Lance Yang > --- Looks good to me, Reviewed-by: Harry Yoo -- Cheers, Harry / Hyeonggon From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id kMywBonw22ivrxAAYBR5ng (envelope-from ) for ; Tue, 30 Sep 2025 15:00:25 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 30 Sep 2025 15:00:25 +0000 Received: from sy.mirrors.kernel.org ([147.75.48.161]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v3bq2-00000004m5T-2jvC for hi@josie.lol; Tue, 30 Sep 2025 15:00:25 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D22B17A6223 for ; Tue, 30 Sep 2025 14:58:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7AA40307AD2; Tue, 30 Sep 2025 15:00:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="OWwsqzxm" X-Original-To: stable@vger.kernel.org Received: from DM5PR21CU001.outbound.protection.outlook.com (mail-centralusazon11011011.outbound.protection.outlook.com [52.101.62.11]) (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 AFD2A306D23; Tue, 30 Sep 2025 15:00:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.62.11 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759244417; cv=fail; b=gMQ76LT/fdCch3x6K6Hj/BlUx0IIGwZykW3cCd0eqsUWBZT+MePwdUONeHnTxW1NPBV4A2/6i4GTmxd4CMUey4qxMoxatnk3IrbOTifZgnkzU/GFpMjfYpGVuMAxDN4OPWK5w3pFeufrEjRzI9LU98OyUjJklRiydoUA0RUTrwI= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759244417; c=relaxed/simple; bh=l4MGMYrn3wEde7zBYtgYGD+sjKXcNB7moQoEPTWqbII=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=O9gROAA1OnfX4S34Cbt3gKd1xVUNKaau0J2UI8iU8z2onBdWc+J+X7eK5Szxzl7XKtn66VBJZZnoU+IOTJ4b9Kb5juCwWaFd3nmPF2ht5LUx6FDV0DNZ1wwJa8kGLWlmR1r2NvUkmiyXEEepBnmZx+AESaGKA+jwJ6GtTbMWMcg= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=OWwsqzxm; arc=fail smtp.client-ip=52.101.62.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JIsorty8JLbiKAX2aCIV1JqNQxsYcW8Z6gnUrkn4AXxQja6IfWdQ0iVhWZ6tz/8u9NjuaLptzYQkR5J76nQ1pJM4F5sG8kWRK61JQdaZyTlx1zaFwVPZ8IAuPDzt/cBCmPMVbinEp63YfFUuoILHqAwzUS4KilkW4hrApMaihnGoiZPTul7LXOdrGNTCOKSVx97x6kdoRYBaTARwHU6NafsT50SgWJboRELVDn4Rl7xpgWSVrQKrd3Yn+0Bcs8Xu999eP8MeZZW3EsoQmmThbVae0UkRD2fGtTCNlboiwVLv6Wctewqq+5wrRHt+0SkRrtiq8u5uQE1FoDBSOa9/Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=045mX67bklqMXTDBLbye5fsIt7Y0nLGzq1LXUiyTojI=; b=bEbWZDSWIJ2bGxIGetJwMkYtd6BhDJq1ZTs33tOpWLCEcjpf4EpuQR4eo0vkQG5n5xmT1M6uzPkdfuXqmrNWmAGF6v0SM0swQjpbZ4vObGnYo2MJbD6Z6VSO56xfQ9+gY92tnY2XYbC4agAkvnWI/42BaGzCvgTk43p4E5NEcvilbRYvMgq/cAqsI41Dfze+WtmAP9uhhdkbWUfr7F9TGFJq5G1XJFQGrus4ohQNMo/rb3r8vj+QM1dlRkRz0EQa9o18LrPLIvEa7emCt9Td06aHtax5FDpnWm4ZBpLgC16L0gnp4tAfDp81BQ/hOFhrjO4ReU9wMXhgUSWaZ4lpDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=045mX67bklqMXTDBLbye5fsIt7Y0nLGzq1LXUiyTojI=; b=OWwsqzxmlWE9wxUMn8KJlZXCq1szN+h4bRnKmio/+e0bHMJiADLhaBY0Wd51H0Nc05iSXB4VA0X2pSBDDpHvEkhxR21YLlmf6haoKeRtjvZY4BjIjNKUtvTF+erE31PtiN70wttqdMHNzEHkLoz41NJGOQhE+kDEBSdbCUpdOSYgsWnXb5ZAecIdpzqhoNGThb4gd0h4D6ZREEESzLaoGtYoxp7JfqUcdTtJGkLWs3QjUPbLvPjN0r8hi889fwweyrWsbGlHdOhAFF33Di4WHfiCrBoJvDWTCW9St6T+X3qR1E8jRxNoGWFNhMYKt6wSbzD6aL7Va74Cq17CMf2Uhw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) by DS2PR12MB9711.namprd12.prod.outlook.com (2603:10b6:8:275::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9160.18; Tue, 30 Sep 2025 15:00:08 +0000 Received: from DS7PR12MB9473.namprd12.prod.outlook.com ([fe80::5189:ecec:d84a:133a]) by DS7PR12MB9473.namprd12.prod.outlook.com ([fe80::5189:ecec:d84a:133a%5]) with mapi id 15.20.9160.015; Tue, 30 Sep 2025 15:00:07 +0000 From: Zi Yan To: Lance Yang Cc: akpm@linux-foundation.org, david@redhat.com, lorenzo.stoakes@oracle.com, peterx@redhat.com, baolin.wang@linux.alibaba.com, baohua@kernel.org, ryan.roberts@arm.com, dev.jain@arm.com, npache@redhat.com, riel@surriel.com, Liam.Howlett@oracle.com, vbabka@suse.cz, harry.yoo@oracle.com, jannh@google.com, matthew.brost@intel.com, joshua.hahnjy@gmail.com, rakie.kim@sk.com, byungchul@sk.com, gourry@gourry.net, ying.huang@linux.alibaba.com, apopple@nvidia.com, usamaarif642@gmail.com, yuzhao@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, ioworker0@gmail.com, stable@vger.kernel.org Subject: Re: [PATCH v5 1/1] mm/rmap: fix soft-dirty and uffd-wp bit loss when remapping zero-filled mTHP subpage to shared zeropage Date: Tue, 30 Sep 2025 11:00:03 -0400 X-Mailer: MailMate (2.0r6283) Message-ID: <98A8D177-A476-4D97-B6C4-DC3F34E91126@nvidia.com> In-Reply-To: <20250930081040.80926-1-lance.yang@linux.dev> References: <20250930081040.80926-1-lance.yang@linux.dev> Content-Type: text/plain Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BN9PR03CA0506.namprd03.prod.outlook.com (2603:10b6:408:130::31) To DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR12MB9473:EE_|DS2PR12MB9711:EE_ X-MS-Office365-Filtering-Correlation-Id: 14888aa3-0d40-4cc5-fe94-08de00320b76 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|366016|376014|1800799024|7053199007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?BUA5L6qR9Q9kZ0O0Wsp2N3T2lvkAlTono+EdQtDcpGUpnul8CEHvfZ21OPrG?= =?us-ascii?Q?Tv43LPp9jkO2JvsWg/pfk2o8FXeYICtc4d9cm0AF4d87ZaksK0gUGPZcjySY?= =?us-ascii?Q?2gSh4QOio6NNHSf4dwnj3jC/aymoyFHyKInxwsGXxdJwv9hL8fuvmudperCT?= =?us-ascii?Q?RqsmGuD/XRJQhH8H45/NSmr32BDH47uWDLu5iqn3AdwQMUJJg+IcD9dcKB82?= =?us-ascii?Q?zi4Q6PPyNwhAWnpRIl92/wGpMFMMemuZRf95bOrmJBbBDd9dWku+djrrTQa8?= =?us-ascii?Q?djGEGfmvcqXjZqR0AP3pNHfW0RX0Fv5n1aR/9tEuIHrrxY/EmX85st5ksCuj?= =?us-ascii?Q?HUxVvb0eSuZYEylgGwGxN7fQbmIs7zMiWS9eqhXM4P2yB7DOJsCMFZYFqrKk?= =?us-ascii?Q?z5lBgDeSLScHgA6PqWuJgCjg9/TEOvCmplGeGRa/LQSi/1YkMkZjyEqpPT8e?= =?us-ascii?Q?d4bW7bI1fME76PLaZF2cJeMlCRfH852IzoD9bh+HWuXxCBNebvJG1A+bBei1?= =?us-ascii?Q?LUvZu37SlAcJpsW1kavTvRiPdRgPIf6xQbctGZZOG0DhUYvEjxWlygho7qXy?= =?us-ascii?Q?EfTyR562huYPraNFl6ciNjhBPvdtujT5C83Yy6DLatAuTKwnJV0qWLybHVyj?= =?us-ascii?Q?i2acKAv9KzgtjsiPzPU6hKa5M9a+2cxdZc4oEpj4yuBE+NMwoc0sKWZrzPM9?= =?us-ascii?Q?oIpYMEfMtqemMEYM3R5IOwXy665ZrgI2f95haZEmMpuBG1WM6FYUDNeKINYl?= =?us-ascii?Q?azb579AgwE7b4gh+E4SPTcJ1bO+dLTjf7KGmvqqFU/F4dtdkfzxS5aRoH9uO?= =?us-ascii?Q?3Gpdy5QYuK3FViFJqVQltmogukLQXQWNzIxjM7aVCSG5CG2MXhpO+dnNudCi?= =?us-ascii?Q?12wfyVqzMmmDpbMVxJevQ2h7zn7t9V0YZBSapys7yMamxyScmfMST7mBcsMQ?= =?us-ascii?Q?fxn6dLSE+2n7GCnA3pC0gcu8SLR27Jj95U4+kFLr/R5yjG9C8Whk1k5/pZdc?= =?us-ascii?Q?uTzoQICOGHxhJ7pjXf8OfSIXp4wVfhn3pZJ/ZgAmeVJV8b+vVnkst7I7VaPr?= =?us-ascii?Q?CBB+0xHXQEsuDcHHERJVTL3DlwNWGVtvnsN12bdrMmOCnKI5iTq/DJH5Kumt?= =?us-ascii?Q?xV+hoixBYG1F5lBsK209D32vHf7KbPvCEBxLH13UP15ySrXK/vr6T5VnV5ib?= =?us-ascii?Q?JMVzSLutj31sPICiOJlwdl8cHMAtCykhAIbv9nSORULta+FlYeDFVO/qcVMN?= =?us-ascii?Q?XUT4cH5psYbVab04I/gYt5QKKnhSv/cF3iHDgjl4x5oWjppHhVFUnF/Y2O+A?= =?us-ascii?Q?n9ynP+ytuKYxO515aOpmFH9LMl9eEuV8Q1JaXMeejTsX8wTkgM59IWcLEkMY?= =?us-ascii?Q?UWykbw6+ImbEQL4PHv9H69xEhvUnogqf4W1HpNs1BRVFHaNBzII4ioAqLraU?= =?us-ascii?Q?zn9mqgDfqRN0UUxKQ9gwD+RVHbcgO7q5Ir0NT/W2Bq+GLELwrl5oGQ=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR12MB9473.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(366016)(376014)(1800799024)(7053199007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?NOA29DnCULw+bA0QYSz+tzFnXgnxPXUK/7gEGd7S64654sjFBNpaOPS8sA5d?= =?us-ascii?Q?uJ8oGkLtyS7D9OhkZCi2Vcs3b02h8eXFjv2Tw1UI4U90p0EyIxRhN/rueZiQ?= =?us-ascii?Q?14YyzJbI7QiO4wEo3opWz31HVeQCTvN6xJR7gn435WvBV0bFJAShA26hJAds?= =?us-ascii?Q?oYm1hnWZ7aIkIoxx+3YfMnbZx8oXNFxGYamk2tksS5SyPWGomEoq5N5tgUTy?= =?us-ascii?Q?N/Hz5xwQZuqIKMgXg5hhSwjJeNDcBZwIwJXeKRJtBqgWO00mqUX7Mr9vQbLw?= =?us-ascii?Q?I3jCSBlhvB1+Cjr6tRKg2ZhsJR00qeSj+24p0/bHH5PHzxQau05qANH6SLoF?= =?us-ascii?Q?MBKciTccpXqwxuMGIvvg3MQNAjfAErsNp5Zp+7BZymMFxXZGkjhzhu25Xhac?= =?us-ascii?Q?eTji1VgXNUstWa00xAmk7GDKne2FnwHHHllMyI2N6zVZdgI8/F068WBEemDr?= =?us-ascii?Q?FrusPIXJjmdfMl2yU/KSCHvCto213VfQgRIb7zF/lko+Kb+4YOzejo9CJNtg?= =?us-ascii?Q?sdKuaYF86GmrqSYbyK0YGfQGTYPUk7BESgSqE7QwjQl1GBNK6cb/hmTM72v9?= =?us-ascii?Q?vOBgRmSp9WhpvLJaznOfgPYgqpNHHOK02nPUOpmqribzlZwYxAQ4m8JiOdAU?= =?us-ascii?Q?C6MFK+bLrNP09S6hSnu4njdPJffMTtKZmkwWAI3U/iVa+rRNX56d015nd7D2?= =?us-ascii?Q?MhriP/FzCOm4jPPa/2Glkw0E3WL3gJtaE1cOuB/AC7TD32D7X6Nci/Vz1hIr?= =?us-ascii?Q?weaWtUvn9E+jqr23Drv74puo1HSy4wA+A15TkuzMcmaE8pBRIqUi37oOJufC?= =?us-ascii?Q?GzI3sPNaw0nB3RJWmbxWIfirptBDVipJJncmJ4x3BAiHQNphOz6KrjrQos2G?= =?us-ascii?Q?PLQWkKrsygi3dlvNh5chqv5TTeVGoJsar+z8FPf4nA1vLRNOgLpvJ+76Sc9s?= =?us-ascii?Q?7Nf/7aK9PxryEKc60Qb6NdnF8Bq3bse4/c+iIV6MFX8VB7cg5du6/fpt1KzH?= =?us-ascii?Q?YLl1EmZubSeWV0Hsv5Cbphqs45Gh9dT2qbxCxgodQ1sfBsK5XF5G//u16zhD?= =?us-ascii?Q?HDUtUHdIMCFzLYlnW/rJatMD1Gzs4HIBGL8ZPGPGTfkkDXlbxdKFfDs6vO9J?= =?us-ascii?Q?jDZYdeH1W8u+KWvSKHaQWVb/D7x0A3W1Be7nZl8a4+9hc/kX3Ny/Fakp0lf/?= =?us-ascii?Q?gjIv949qt2cpozSR8/4fm3zOE5YNrpRlyMNJ1IpePKTc5MrnEt3QkmGzol1p?= =?us-ascii?Q?+9RgBmRuAQqCSxS6+KNv/4/XPH3z3LnmQw8pKHYE6602hVNLiARgR5VJ6psN?= =?us-ascii?Q?JfEnWRd9UKlmsaPuWIT8L0FmFboC6IRIjMOVVPvK4JlMQnoNC9etEiiLe76L?= =?us-ascii?Q?lzilcW72d454CblN9TEjSHGdZncIJXv14mU1k2vLK6gIhwsSbOHP0CPHaeaq?= =?us-ascii?Q?cjxmri4+LE9OmWougMI+gLUF/CPZIdEzNLOlLayGzLWJBNL74PZ6tUx11Bn8?= =?us-ascii?Q?hrh1eoP76FFrOxTRNf4QxMJyIo3NN8qjhwZKFWH3WyEU/g1ShoXhZvIxw8Za?= =?us-ascii?Q?FztzNHoVSAqxmP2Fk93hOsueW8essPumiTe0IKnQ?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 14888aa3-0d40-4cc5-fe94-08de00320b76 X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB9473.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2025 15:00:07.5810 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: biGW8kX16xvGISVPjPRl4U1c893kdEPBzqTviBWyokpgSFu2JuQ7St9tCZbNSsAt X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS2PR12MB9711 X-DKIM: signer='Nvidia.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -0.0 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-0.0 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: nvidia.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.48.161 listed in bl.score.senderscore.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.48.161 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.48.161 listed in sa-trusted.bondedsender.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.4 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: 0 On 30 Sep 2025, at 4:10, Lance Yang wrote: > From: Lance Yang > > When splitting an mTHP and replacing a zero-filled subpage with the sha= red > zeropage, try_to_map_unused_to_zeropage() currently drops several impor= tant > PTE bits. > > For userspace tools like CRIU, which rely on the soft-dirty mechanism f= or > incremental snapshots, losing the soft-dirty bit means modified pages a= re > missed, leading to inconsistent memory state after restore. > > As pointed out by David, the more critical uffd-wp bit is also dropped.= > This breaks the userfaultfd write-protection mechanism, causing writes > to be silently missed by monitoring applications, which can lead to dat= a > corruption. > > Preserve both the soft-dirty and uffd-wp bits from the old PTE when > creating the new zeropage mapping to ensure they are correctly tracked.= > > Cc: > Fixes: b1f202060afe ("mm: remap unused subpages to shared zeropage when= splitting isolated thp") > Suggested-by: David Hildenbrand > Suggested-by: Dev Jain > Acked-by: David Hildenbrand > Reviewed-by: Dev Jain > Signed-off-by: Lance Yang > --- > v4 -> v5: > - Move ptep_get() call after the !pvmw.pte check, which handles PMD-ma= pped > THP migration entries. > - https://lore.kernel.org/linux-mm/20250930071053.36158-1-lance.yang@l= inux.dev/ > > v3 -> v4: > - Minor formatting tweak in try_to_map_unused_to_zeropage() function > signature (per David and Dev) > - Collect Reviewed-by from Dev - thanks! > - https://lore.kernel.org/linux-mm/20250930060557.85133-1-lance.yang@l= inux.dev/ > > v2 -> v3: > - ptep_get() gets called only once per iteration (per Dev) > - https://lore.kernel.org/linux-mm/20250930043351.34927-1-lance.yang@l= inux.dev/ > > v1 -> v2: > - Avoid calling ptep_get() multiple times (per Dev) > - Double-check the uffd-wp bit (per David) > - Collect Acked-by from David - thanks! > - https://lore.kernel.org/linux-mm/20250928044855.76359-1-lance.yang@l= inux.dev/ > > mm/migrate.c | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > Acked-by: Zi Yan Best Regards, Yan, Zi From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id MFaLAg6R22jghhkAYBR5ng (envelope-from ) for ; Tue, 30 Sep 2025 08:13:02 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 30 Sep 2025 08:13:02 +0000 Received: from ny.mirrors.kernel.org ([147.75.199.223]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v3VTp-00000008K6g-2WUt for hi@josie.lol; Tue, 30 Sep 2025 08:13:02 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B69E3162D02 for ; Tue, 30 Sep 2025 08:13:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2AD7E2F3635; Tue, 30 Sep 2025 08:12:58 +0000 (UTC) X-Original-To: stable@vger.kernel.org Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B9E927A114 for ; Tue, 30 Sep 2025 08:12:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759219978; cv=none; b=WI8MK/fdn+4f9INApppKIFzwWaK4KDxaqsmLwRWruTvywlCpF9nAg81sR4DoujeKroIlmQA+46fPhHo5w/D+C2PVT/r+zLeyyI+4LolYZVTfKe8J3SOL8PBCBQivG6co8NQJgixk4OSB6k1ezpiOELbqUCgJIS5K2mmNFT1eHKk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759219978; c=relaxed/simple; bh=W6oDfQ3tA6Pme1gatYJbw8/yR7JHBTFPfjYXtL5BQIw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=BbI/9GWKzV2OGTOUmb/jxs9PsJARLREPzzFfgORTgbGu4+l90Y/sOPL1cQ4tR674haBL198uuTfPDExdXVx+veMH3zp+etjGlwbUb91g2aWLV/9oaEK0rMBUDdxG8gHRePxKjb2tfSRS7Nnu5FM+f8ciHRgoTxyWfnxlA7xBigA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-46e42fa08e4so32026395e9.3 for ; Tue, 30 Sep 2025 01:12:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759219974; x=1759824774; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vAJ15PCYe/3t3twFi4VSUK9WUI+ae4tv6+Eg5/cOO8M=; b=XmY92V5vGXMAd6mxrwDelhGaEIjRcyojm6Bf3hseaXDHWt+AgCfrYW6Fmqu4E/lZOB Bxj/bqaNpqSX2lXJpj0uH7znVT43LNXl5+7R+3Mk1a99C4cw1IiADGDYr0N1SUgosx5O iOv7wS9xO1ItEjSnTcT1+9nQDYy4GLT3jt3F0vNhrpihOhNuB+l+TKnbWr/qiQWBRlme W9xIJcMadhauod3peXFsD3o1NPYjJIt5udrFFnxGeolU50PxO39Htuhk/6rAW6d/AvPB Ihk0JFj4qqebDw1dulpIn8kO2+snC98k3nVx9yXIEnM/O476aInjlqSwGSpWtyGf16ii WuCw== X-Forwarded-Encrypted: i=1; AJvYcCXpxvhEfm2sG8Jnulx075y4IbGqzE84wPlKXNxTnIa2NKfEDFjjMxUdYLnfTEqd2pMScB8Jgko=@vger.kernel.org X-Gm-Message-State: AOJu0Yxt5zPcQGrE/lYj70WHmkE/yFg3Icz5wo7qEORUIs5VKA2LO7SJ 5daa0I4mLv892H452nAAvd7HvKwi134tHKNhnRLkPGkwBFa1tS1s3erM X-Gm-Gg: ASbGncsKueXFlSswosZgwsC8Fk8ZVS3fyH13QBxDzhO44wOMgN4gsXbVSkMVBP7vbvw WUCpFeKaOgHrmGw2pURLA9etdhLI39Vps9FxGXmz4o3wD0OnBcUr6xcFLB7sRaTMKZxs+zZT3kP nQCCCogliLiBr4PvtiDZ9/NkayeyTTz73XBXSUQGW5fjoBAN20Y6XDqpkBOnQULbh5+H/B34hrV plEovtRTdMECNzvf0haaxU4Eo+cHR6l34ZNB76TfJcskbvxpAa+jzk2HHY/5pY4owjcMbQkk06I /DccgqMJIkzb0pSiLVGF8roEpc+Y+olPd57RPmrPyy7VpJmjfKhMAm9YBb8LJuZdCdM/+ZBXwJo sR1bDQNDct1TCwkUtyXPRi4iywmAM7sz1yOmPFJk= X-Google-Smtp-Source: AGHT+IE2NS+/omW5KgBKG9n82/mtd7IUS3Rs9tnSrN83FJMEVfCJNhTiuTT9MEUw76ccVMhV+on3xQ== X-Received: by 2002:a05:600c:1c88:b0:45f:2919:5e6c with SMTP id 5b1f17b1804b1-46e329c5735mr275530785e9.16.1759219974301; Tue, 30 Sep 2025 01:12:54 -0700 (PDT) Received: from localhost.localdomain ([2a09:0:1:2::301b]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-46e2ab31f62sm258959085e9.15.2025.09.30.01.12.46 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 30 Sep 2025 01:12:53 -0700 (PDT) From: Lance Yang To: akpm@linux-foundation.org, david@redhat.com, lorenzo.stoakes@oracle.com Cc: peterx@redhat.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com, baohua@kernel.org, ryan.roberts@arm.com, dev.jain@arm.com, npache@redhat.com, riel@surriel.com, Liam.Howlett@oracle.com, vbabka@suse.cz, harry.yoo@oracle.com, jannh@google.com, matthew.brost@intel.com, joshua.hahnjy@gmail.com, rakie.kim@sk.com, byungchul@sk.com, gourry@gourry.net, ying.huang@linux.alibaba.com, apopple@nvidia.com, usamaarif642@gmail.com, yuzhao@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, ioworker0@gmail.com, stable@vger.kernel.org, Lance Yang Subject: [PATCH v5 1/1] mm/rmap: fix soft-dirty and uffd-wp bit loss when remapping zero-filled mTHP subpage to shared zeropage Date: Tue, 30 Sep 2025 16:10:40 +0800 Message-ID: <20250930081040.80926-1-lance.yang@linux.dev> X-Mailer: git-send-email 2.49.0 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.5 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.199.223 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.199.223 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.199.223 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 5 From: Lance Yang When splitting an mTHP and replacing a zero-filled subpage with the shared zeropage, try_to_map_unused_to_zeropage() currently drops several important PTE bits. For userspace tools like CRIU, which rely on the soft-dirty mechanism for incremental snapshots, losing the soft-dirty bit means modified pages are missed, leading to inconsistent memory state after restore. As pointed out by David, the more critical uffd-wp bit is also dropped. This breaks the userfaultfd write-protection mechanism, causing writes to be silently missed by monitoring applications, which can lead to data corruption. Preserve both the soft-dirty and uffd-wp bits from the old PTE when creating the new zeropage mapping to ensure they are correctly tracked. Cc: Fixes: b1f202060afe ("mm: remap unused subpages to shared zeropage when splitting isolated thp") Suggested-by: David Hildenbrand Suggested-by: Dev Jain Acked-by: David Hildenbrand Reviewed-by: Dev Jain Signed-off-by: Lance Yang --- v4 -> v5: - Move ptep_get() call after the !pvmw.pte check, which handles PMD-mapped THP migration entries. - https://lore.kernel.org/linux-mm/20250930071053.36158-1-lance.yang@linux.dev/ v3 -> v4: - Minor formatting tweak in try_to_map_unused_to_zeropage() function signature (per David and Dev) - Collect Reviewed-by from Dev - thanks! - https://lore.kernel.org/linux-mm/20250930060557.85133-1-lance.yang@linux.dev/ v2 -> v3: - ptep_get() gets called only once per iteration (per Dev) - https://lore.kernel.org/linux-mm/20250930043351.34927-1-lance.yang@linux.dev/ v1 -> v2: - Avoid calling ptep_get() multiple times (per Dev) - Double-check the uffd-wp bit (per David) - Collect Acked-by from David - thanks! - https://lore.kernel.org/linux-mm/20250928044855.76359-1-lance.yang@linux.dev/ mm/migrate.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index ce83c2c3c287..e3065c9edb55 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -296,8 +296,7 @@ bool isolate_folio_to_list(struct folio *folio, struct list_head *list) } static bool try_to_map_unused_to_zeropage(struct page_vma_mapped_walk *pvmw, - struct folio *folio, - unsigned long idx) + struct folio *folio, pte_t old_pte, unsigned long idx) { struct page *page = folio_page(folio, idx); pte_t newpte; @@ -306,7 +305,7 @@ static bool try_to_map_unused_to_zeropage(struct page_vma_mapped_walk *pvmw, return false; VM_BUG_ON_PAGE(!PageAnon(page), page); VM_BUG_ON_PAGE(!PageLocked(page), page); - VM_BUG_ON_PAGE(pte_present(ptep_get(pvmw->pte)), page); + VM_BUG_ON_PAGE(pte_present(old_pte), page); if (folio_test_mlocked(folio) || (pvmw->vma->vm_flags & VM_LOCKED) || mm_forbids_zeropage(pvmw->vma->vm_mm)) @@ -322,6 +321,12 @@ static bool try_to_map_unused_to_zeropage(struct page_vma_mapped_walk *pvmw, newpte = pte_mkspecial(pfn_pte(my_zero_pfn(pvmw->address), pvmw->vma->vm_page_prot)); + + if (pte_swp_soft_dirty(old_pte)) + newpte = pte_mksoft_dirty(newpte); + if (pte_swp_uffd_wp(old_pte)) + newpte = pte_mkuffd_wp(newpte); + set_pte_at(pvmw->vma->vm_mm, pvmw->address, pvmw->pte, newpte); dec_mm_counter(pvmw->vma->vm_mm, mm_counter(folio)); @@ -364,13 +369,13 @@ static bool remove_migration_pte(struct folio *folio, continue; } #endif + old_pte = ptep_get(pvmw.pte); if (rmap_walk_arg->map_unused_to_zeropage && - try_to_map_unused_to_zeropage(&pvmw, folio, idx)) + try_to_map_unused_to_zeropage(&pvmw, folio, old_pte, idx)) continue; folio_get(folio); pte = mk_pte(new, READ_ONCE(vma->vm_page_prot)); - old_pte = ptep_get(pvmw.pte); entry = pte_to_swp_entry(old_pte); if (!is_migration_entry_young(entry)) -- 2.49.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id KI8QJHND7mhrOxUAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 12:34:59 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 12:34:59 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8eF1-00000005v6J-0Ue7 for hi@josie.lol; Tue, 14 Oct 2025 12:34:59 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C2B5E19276C2 for ; Tue, 14 Oct 2025 12:35:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9563130FF33; Tue, 14 Oct 2025 12:34:54 +0000 (UTC) X-Original-To: stable@vger.kernel.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) (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 5A661307ACC for ; Tue, 14 Oct 2025 12:34:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.40.44.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760445294; cv=none; b=XE9INPDpJ4OoOfIc4sD+pnJkTs6DqxTa+nkOQauR37aM/TlpkNgFuEw9jLe+SwuYrn+tDk5cwWGK6UNn02YL6rY4SJba/lKHV1xt6AjibkXi6MClFZbiR7FXSQbKOxlfzNpO1hZfr8FAAlB2ovHyNZ6PICwvyIYsDt42szDWLTM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760445294; c=relaxed/simple; bh=Q7ApbViSbZxT55NIMBJovMrAt1ZiztiCtjjkU0yeZPw=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=euqdM+opkwAA+KepWHSrHu6J6TVbSKJxD3gCO18stffuViS3nz129jY+PO0KRmDVjB7Oq2yB7DXQOsTWBD/PCBuTzHPuFNQN7D9nxDddsGSdoFbHG2Sn+ef+B47JsOVUgIhuFw3Zg0k9YKOIDgswMUVHF+aH/u7ZYDn81+FJgtA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org; spf=pass smtp.mailfrom=goodmis.org; arc=none smtp.client-ip=216.40.44.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=goodmis.org Received: from omf10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 29F4EC08F4; Tue, 14 Oct 2025 12:34:49 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: rostedt@goodmis.org) by omf10.hostedemail.com (Postfix) with ESMTPA id EB33C40; Tue, 14 Oct 2025 12:34:46 +0000 (UTC) Date: Tue, 14 Oct 2025 08:34:52 -0400 From: Steven Rostedt To: Greg KH Cc: Saravana Kannan , luogengkun@huaweicloud.com, mathieu.desnoyers@efficios.com, mhiramat@kernel.org, runpinglai@google.com, torvalds@linux-foundation.org, wattson-external@google.com, stable@vger.kernel.org Subject: Re: FAILED: patch "[PATCH] tracing: Have trace_marker use per-cpu data to read user" failed to apply to 6.12-stable tree Message-ID: <20251014083452.10235c41@gandalf.local.home> In-Reply-To: <2025101418-buckle-morally-2eb9@gregkh> References: <2025101354-eject-groove-319c@gregkh> <2025101418-buckle-morally-2eb9@gregkh> X-Mailer: Claws Mail 3.20.0git84 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: EB33C40 X-Stat-Signature: nqkyn7tkaduzo8m4k836dzk65cthix65 X-Rspamd-Server: rspamout06 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Session-ID: U2FsdGVkX1/nfLCN585RQ2LkdZWsMD2YvOiU4mn/GLE= X-HE-Tag: 1760445286-665913 X-HE-Meta: U2FsdGVkX18p0qaHXp00D8LAa8D4UrYTb8S2GWGyWk7ZG718UfwkMr2NtrqZbR2mOeoCy3Ygn98TY4VH6BASX4C1rl8k4Vg94u5hCHkxCIy3iXJRLYIdQ6Wr/YqTzpLoBY0IUF7stb3ESykLHSNTge82qu8FxaD9Q5qd7drZt6rjgeOtrKBmN1upNqVSCEo56giaAJXhbmi4Z52rQq0Ik8hXcFlkhbFXPXeaatCppP/iGmE7j3Vfuic584BredKRePYjNGLBqmdOIpG0poFDfhTZldKZ/+dzC1iV+ulMKj6sZunvhIzvHLnZ9DjBl7h1eRZdzRr1m31/46BpjrYiMT7X2ZEXloxZPRQcSKDi2Zlg6RWzEVOQqtTN4A9q/lSpTAuP2gvEzZ3xt+53i2Zlyi3Bsq2M2Srn X-Spam-Score: -1.8 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.8 points) --- pts rule name description ---- ---------------------- ----------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [147.75.80.249 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: -17 On Tue, 14 Oct 2025 07:10:48 +0200 Greg KH wrote: > > > > IIRC, this is a fix for something that went in after 6.12. So, don't > > need to backport it 6.12 or older. > > The "Fixes:" tag references a commit that is in the following releases > already: > 5.10.245 5.15.194 6.1.153 6.6.107 6.12.48 6.16.8 6.17 > so that's what triggered this message. > Correct. The bug has been there "forever", but because it required PREEMPT_NONE to trigger, and most people don't use that, it hasn't been reported. The fix to the PREEMPT_NONE issue had a regression, thus both fixes technically need to go back to the beginning. If I get time, I could work on backporting these patches. -- Steve From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id MKIfBGHb7Wic1R4AYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 05:10:57 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 05:10:57 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8XJI-00000008mSD-2DVc for hi@josie.lol; Tue, 14 Oct 2025 05:10:57 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8A346405D1E for ; Tue, 14 Oct 2025 05:10:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 327061F4295; Tue, 14 Oct 2025 05:10:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="1qhyp8dm" X-Original-To: stable@vger.kernel.org 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 F1B6B1E9905 for ; Tue, 14 Oct 2025 05:10:52 +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=1760418653; cv=none; b=NlmNY7T/h6xxQ+wsEMdIQe/WPrLnaw0uX799BVa+7ygjR0Vyacap3t/ugYFER04VwlAaYiNJreTyWpVypqXLTWspil6LcKEo28zKdSV97bVZz1zAsrjzNUj5jDEdk6YvE3V1zBdHf7WgKnwRL7tg7IwU9evuOvew7LFb1YQFeng= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760418653; c=relaxed/simple; bh=W/AafAdDrtZsfYTSvvq5M4QbBbJ+Q4BH+pjCWy3Q7q8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=knm0IE0O/ABe5XN7p7Pn9iYWsLjcv5Tp4mW9hkiBtTDn+jNM+MLt2i/glO7R8u9gXO1o+uElSPr6wVxQ/p+JhJXFm/vpMMv7GsQi18DxdhUY8Jto0eErTEYnhKRVvbkdbwwhcmFA1WK117HNseun1D6EpJ8LX+JxmiIQAEDskxI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=1qhyp8dm; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DFE2C4CEE7; Tue, 14 Oct 2025 05:10:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760418652; bh=W/AafAdDrtZsfYTSvvq5M4QbBbJ+Q4BH+pjCWy3Q7q8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=1qhyp8dmBU1qWvJtoLm/ejxhQjD+AxDMBgZ/Hat2c5y7P9w9DYeQUkQEJn1CgewT2 DCxlm6R+6NdW1XD3+MOefUqTWm5f6fqNl6BZqoJzYqjAtd23nvqLaKK3Iol9pX3WG+ sJ2oR8hBJ8Jp4t8fzKMiHkcfYS7nlrHW8s+FORHY= Date: Tue, 14 Oct 2025 07:10:48 +0200 From: Greg KH To: Saravana Kannan Cc: rostedt@goodmis.org, luogengkun@huaweicloud.com, mathieu.desnoyers@efficios.com, mhiramat@kernel.org, runpinglai@google.com, torvalds@linux-foundation.org, wattson-external@google.com, stable@vger.kernel.org Subject: Re: FAILED: patch "[PATCH] tracing: Have trace_marker use per-cpu data to read user" failed to apply to 6.12-stable tree Message-ID: <2025101418-buckle-morally-2eb9@gregkh> References: <2025101354-eject-groove-319c@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-DKIM: signer='linuxfoundation.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linuxfoundation.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: 4 On Mon, Oct 13, 2025 at 12:42:19PM -0700, Saravana Kannan wrote: > On Mon, Oct 13, 2025 at 1:27 AM wrote: > > > > > > The patch below does not apply to the 6.12-stable tree. > > If someone wants it applied there, or to any other stable or longterm > > tree, then please email the backport, including the original git commit > > id to . > > > > To reproduce the conflict and resubmit, you may use the following commands: > > > > git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y > > git checkout FETCH_HEAD > > git cherry-pick -x 64cf7d058a005c5c31eb8a0b741f35dc12915d18 > > # > > git commit -s > > git send-email --to '' --in-reply-to '2025101354-eject-groove-319c@gregkh' --subject-prefix 'PATCH 6.12.y' HEAD^.. > > > > Possible dependencies: > > IIRC, this is a fix for something that went in after 6.12. So, don't > need to backport it 6.12 or older. The "Fixes:" tag references a commit that is in the following releases already: 5.10.245 5.15.194 6.1.153 6.6.107 6.12.48 6.16.8 6.17 so that's what triggered this message. thanks, greg k-h From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id 6MQMCgBG7mhUrxEAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 12:45:52 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 12:45:52 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8ePX-00000006Gbc-3EE4 for hi@josie.lol; Tue, 14 Oct 2025 12:45:52 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 144131927E4B for ; Tue, 14 Oct 2025 12:45:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 557BD31353B; Tue, 14 Oct 2025 12:45:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="FILiOJ2K" X-Original-To: stable@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 9B15D313E06 for ; Tue, 14 Oct 2025 12:45:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760445904; cv=none; b=f80uP8Mm8hyzklxVnGn2D/YICRdDkBLeC7g3//A1to2NWKwjXXbslpVr/OzYJwnGRHfeC4MtiRZZrIRv6KTv3XOeur0IawcKWlt+5GVqyGMJ8QsAuZpiW5Elo3ypJ+SCAN+bcprJI1TWsx2HesINHZWkziRoShjqJeK+0VTSHN0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760445904; c=relaxed/simple; bh=IrdiHcJ9N5g16Q3ASpx314J/26lOuQJs6WEhZdyqT3k=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=gVaBWJxQWJnTnv7+zn2R+f6R5q6sOrNeP7T9jpvbkvuXb0mBSSubsbnF7+X8IEM6SgkHYp9uocPqp+nqs2u3/8AX4Ofovn46a8+ML7ViA53riG2cfM/j5iegMo+ekXZzIKcPSs1TCheVV26Z3Tcs2LDlCdcGqPPr+RDawzN1hh8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=FILiOJ2K; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1760445900; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=oq5FU6UUWvw2KLYz4msTSjy80Lvwg4TbSIDB93lwHNo=; b=FILiOJ2KE0GykacXyD6iUmL+TpbK3IKaJtGMEfccgphe+9CYoRUes68QzyEyKIxlC0ZuUU x32BgbI3gnKRTpyMTsvP3paHypL9NAw/Cb+oYUI/VJ6mIdjcZhGJRu1fTHbqjyCiGbWGts jMv4/XnEerPUl2vx88ImjvTnLPcVSDI= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-609-ijEUjAcuNaWOaDBlliTosQ-1; Tue, 14 Oct 2025 08:44:59 -0400 X-MC-Unique: ijEUjAcuNaWOaDBlliTosQ-1 X-Mimecast-MFC-AGG-ID: ijEUjAcuNaWOaDBlliTosQ_1760445898 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-401dbafbcfaso4191492f8f.1 for ; Tue, 14 Oct 2025 05:44:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760445898; x=1761050698; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=oq5FU6UUWvw2KLYz4msTSjy80Lvwg4TbSIDB93lwHNo=; b=KW+032tDEQS2cRgFPAwLEKs5LZ475pS51nEplOMXHQGS2G0YN2UA7I2vbCMBI60Fta VL7BbAf1YFzNKloHPLhGVHGQAF3SoBsmPo2D3mgYN2OE7VlmNUOIR6HowBATX7jzKOQy Lan4qB+avOaEjJW9r2hD6tZqtcsIDTaa21x0aASzVvV7nXGxaRYiOaJWqg9EvJJmCna2 hAc5402YI/wSxh39S5hsor3LpmuDSzzDzSX+tTKc5gCZQJLEQnYsD1xDiLFE+0hO0L2F VAe89L87jpBdxXc9qhyaf+8sktJYFDPUt2xyMbSnumnYbsbq/EO3pHXJFjRjSRybGviK 6vKw== X-Forwarded-Encrypted: i=1; AJvYcCW28k+CLKI9V1anKA4w1xSvvlRNB0TGC2AJgF+EOyblPb2M9TP5vxjT3yAa7B5Fm6Q84C3OOdg=@vger.kernel.org X-Gm-Message-State: AOJu0YztvaL+gAAgXIcUZQq3HAkE0X54KGYEgg6GTwP7Rl1kx/Z0bCWQ iq2aOP7vFgytD4YJcJFgAuF6mve6Ci49aMFsiSwhLhC/SNCZDMqVneyWV3tkDEI7bK7Dtc/Gibn 4ZBtbtaBDxm9Lj82EuqwP6Pkrqn9jLMepycsc8Zk8xG8/Pt6K9fyUVgR52Q== X-Gm-Gg: ASbGncsX+e1arxtnw3qP3Ayp8lglVU/wga5py8F1NXwn/QAl6f3tqp2OI3yZsQ7+zfw 0hDYCWb9oVmxzqIc1AQd3iqloSQScepy98khS0Ge605p4Lt3IIZHlP2yW4yJlo/8s4OlAs2vPVY 29tf6IMrSAPmB/UqzFwrHjxji7fPa6jhFyDr2JPT8g9qufGu8gnFFMFmZwok4QwSMIxrFi9e+NK XHybk9NWaVnQ+6SeFBvkrnbDqFwwl2Flp9+HUyHXIBNzUlOIxpqJ9tX6J2lvevL5fZDkFmuIZTa apNGnwasglVfdJHvsPEtO3+S067Ku0foKO0= X-Received: by 2002:a05:6000:2003:b0:3eb:5e99:cbb9 with SMTP id ffacd0b85a97d-42666ac410emr16251744f8f.10.1760445897966; Tue, 14 Oct 2025 05:44:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGxSeyruCmc9SGR2jeGa4d8IULuUIdP5u2aBzan4Fq5iEL1yjTsOV2vBHOnBmYhi1j6hNaRzA== X-Received: by 2002:a05:6000:2003:b0:3eb:5e99:cbb9 with SMTP id ffacd0b85a97d-42666ac410emr16251717f8f.10.1760445897499; Tue, 14 Oct 2025 05:44:57 -0700 (PDT) Received: from localhost ([2a09:80c0:192:0:5dac:bf3d:c41:c3e7]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-426e50ef821sm8878961f8f.38.2025.10.14.05.44.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Oct 2025 05:44:56 -0700 (PDT) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, David Hildenbrand , stable@vger.kernel.org, Andrew Morton , Jerrin Shaji George , Broadcom internal kernel review list , Arnd Bergmann , Greg Kroah-Hartman Subject: [PATCH v1] vmw_balloon: indicate success when effectively deflating during migration Date: Tue, 14 Oct 2025 14:44:55 +0200 Message-ID: <20251014124455.478345-1-david@redhat.com> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='redhat.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.80.249 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: 4 When migrating a balloon page, we first deflate the old page to then inflate the new page. However, if inflating the new page succeeded, we effectively deflated the old page, reducing the balloon size. In that case, the migration actually worked: similar to migrating+ immediately deflating the new page. The old page will be freed back to the buddy. Right now, the core will leave the page be marked as isolated (as we returned an error). When later trying to putback that page, we will run into the WARN_ON_ONCE() in balloon_page_putback(). That handling was changed in commit 3544c4faccb8 ("mm/balloon_compaction: stop using __ClearPageMovable()"); before that change, we would have tolerated that way of handling it. To fix it, let's just return 0 in that case, making the core effectively just clear the "isolated" flag + freeing it back to the buddy as if the migration succeeded. Note that the new page will also get freed when the core puts the last reference. Note that this also makes it all be more consistent: we will no longer unisolate the page in the balloon driver while keeping it marked as being isolated in migration core. This was found by code inspection. Fixes: 3544c4faccb8 ("mm/balloon_compaction: stop using __ClearPageMovable()") Cc: Cc: Andrew Morton Cc: Jerrin Shaji George Cc: Broadcom internal kernel review list Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Signed-off-by: David Hildenbrand --- I have no easy way to test this, and I assume it happens very very rarely (inflation during migration failing). I would prefer this to go through the MM-tree, as I have some follow-up balloon_compaction reworks also mess with this code. --- drivers/misc/vmw_balloon.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c index 6df51ee8db621..cc1d18b3df5ca 100644 --- a/drivers/misc/vmw_balloon.c +++ b/drivers/misc/vmw_balloon.c @@ -1737,7 +1737,7 @@ static int vmballoon_migratepage(struct balloon_dev_info *b_dev_info, { unsigned long status, flags; struct vmballoon *b; - int ret; + int ret = 0; b = container_of(b_dev_info, struct vmballoon, b_dev_info); @@ -1796,17 +1796,15 @@ static int vmballoon_migratepage(struct balloon_dev_info *b_dev_info, * A failure happened. While we can deflate the page we just * inflated, this deflation can also encounter an error. Instead * we will decrease the size of the balloon to reflect the - * change and report failure. + * change. */ atomic64_dec(&b->size); - ret = -EBUSY; } else { /* * Success. Take a reference for the page, and we will add it to * the list after acquiring the lock. */ get_page(newpage); - ret = 0; } /* Update the balloon list under the @pages_lock */ @@ -1817,7 +1815,7 @@ static int vmballoon_migratepage(struct balloon_dev_info *b_dev_info, * If we succeed just insert it to the list and update the statistics * under the lock. */ - if (!ret) { + if (status == VMW_BALLOON_SUCCESS) { balloon_page_insert(&b->b_dev_info, newpage); __count_vm_event(BALLOON_MIGRATE); } base-commit: 1c58c31dc83e39f4790ae778626b6b8b59bc0db8 -- 2.51.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id sLdFJWlG7mhXdxYAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 12:47:37 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 12:47:37 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8eRF-00000006JjM-0Us4 for hi@josie.lol; Tue, 14 Oct 2025 12:47:37 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 83C07188C18C for ; Tue, 14 Oct 2025 12:46:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EEF991EFFB7; Tue, 14 Oct 2025 12:45:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cjM4nkWr" X-Original-To: stable@vger.kernel.org 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 CA2DE19F135 for ; Tue, 14 Oct 2025 12:45:53 +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=1760445953; cv=none; b=ayyvtZCNuh7Ks0KQnIaOtViD/JK4kkjd7ZLpr8lMgt2L7ieGdOXQSkKKLzk06cyRQQGmXUbagt+KJHZ7WDYw6+OCi03E+fqeVzrqHAJlxl7g2Xhqawb931wGwWyvmGQ4lxMiPBJpC16VB4EuP6jp7AyvAP7Oa3gb5URkmy9G6SM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760445953; c=relaxed/simple; bh=uH9Jx6CBy3u8z1GhKitex81nD8smmfL/NfAyoCTwaOY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=evKLbnx+ATUjkVt4NLmZbpo+p8RP1WujoqVceXZhjEZpWsRrFvx2rDbUXbvW2IENjmqxwdT41UbKCy7qs4uNABrm7i53occQ2AS+EM1Gb0JWadFDqTB8xdpenwr81b792AZ38pCELVeN1MmRf01sja6pwXprVoaQ/fSrztNUWrc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cjM4nkWr; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4D63C4CEE7; Tue, 14 Oct 2025 12:45:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760445953; bh=uH9Jx6CBy3u8z1GhKitex81nD8smmfL/NfAyoCTwaOY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cjM4nkWreL5T++Hm7cSOOenAC3iVW99yFERX5TahCXozQ2PFOq6ZU1hMcq9TZgV3d I6riWPfsWHZMHCtbowWa979YFaZzkxu+kLrB8GeautqC7fC0PRTA1cu+WkManW2JtC E1xgOGsQeEI9KTjtvMc8dePyRILW1YoMjvxEqjj93SNcCp7y+ILPZMTQ1T/iyFJvI0 9b5tA7qDUc6tARpTdUVgXO6YmuEcY323bUMruxvKbKQ3V/VPShrhgootpblitgwQJF 1H0KN2Sj7XxfN9QErQiZVy9KooWoMbGSF9u+ZNkcv4LAYZsNc85AkMI0483PpGvCMu WArPY1oPcP/5A== From: Sasha Levin To: stable@vger.kernel.org Cc: Matvey Kovalev , Namjae Jeon , Steve French , Sasha Levin Subject: [PATCH 5.15.y] ksmbd: fix error code overwriting in smb2_get_info_filesystem() Date: Tue, 14 Oct 2025 08:45:50 -0400 Message-ID: <20251014124550.2777-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2025101324-echo-cardinal-3043@gregkh> References: <2025101324-echo-cardinal-3043@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -3.5 (---) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-3.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [147.75.80.249 listed in list.dnswl.org] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -34 From: Matvey Kovalev [ Upstream commit 88daf2f448aad05a2e6df738d66fe8b0cf85cee0 ] If client doesn't negotiate with SMB3.1.1 POSIX Extensions, then proper error code won't be returned due to overwriting. Return error immediately. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: e2f34481b24db ("cifsd: add server-side procedures for SMB3") Cc: stable@vger.kernel.org Signed-off-by: Matvey Kovalev Acked-by: Namjae Jeon Signed-off-by: Steve French [ adjusted file path from fs/smb/server/smb2pdu.c to fs/ksmbd/smb2pdu.c ] Signed-off-by: Sasha Levin --- fs/ksmbd/smb2pdu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c index 3439dbad93895..c0b5985701bf8 100644 --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -5204,7 +5204,8 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work, if (!work->tcon->posix_extensions) { pr_err("client doesn't negotiate with SMB3.1.1 POSIX Extensions\n"); - rc = -EOPNOTSUPP; + path_put(&path); + return -EOPNOTSUPP; } else { info = (struct filesystem_posix_info *)(rsp->Buffer); info->OptimalTransferSize = cpu_to_le32(stfs.f_bsize); -- 2.51.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id eMCBMTrD7GgHiwsAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 09:15:38 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 09:15:38 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8EeY-00000003ilM-15ny for hi@josie.lol; Mon, 13 Oct 2025 09:15:38 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 7567B4EC190 for ; Mon, 13 Oct 2025 09:15:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 10A122FC877; Mon, 13 Oct 2025 09:15:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="N7g9Vatq" X-Original-To: stable@vger.kernel.org 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 E06B02FC86F for ; Mon, 13 Oct 2025 09:15:27 +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=1760346928; cv=none; b=Fu0y1AOA3biyeNrk4kghOIVdEeVeDx6sE1Fw5sya7MGVvLnRjbWdo3uNIccgszKH5ccVdkw7HBnYL0AT9YmF+1HiCCyOBMqDrOUVwFpVhUSo1dqG+Zqilx3Dfgif5p0+U8C+mLKVFSYFpztwAoRY6g1vE8dAWNWwCbVm25IzPIc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760346928; c=relaxed/simple; bh=c4Y4lpZnXLS9EL5bnIoiWT5a2y5d7B14ZhY9cdc6AHE=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=ZgAhxTtKsAhEOQcI60p0KzBNc152z4JHFfMM/HVr1U2IGJPqY/LQJ4pqjz7FoYSwsC20t4f1OYdu8FzfShXGcB32HPD9I952GTeq9IQAeF7LzlhWIFVyK0T6OMyuMlQGPFPj47fJ6NSKD1eogBVaA+F86f3xRbIb66y9gjbpJEE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=N7g9Vatq; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15716C4CEE7; Mon, 13 Oct 2025 09:15:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760346927; bh=c4Y4lpZnXLS9EL5bnIoiWT5a2y5d7B14ZhY9cdc6AHE=; h=Subject:To:Cc:From:Date:From; b=N7g9VatqUv/JvnycejLljp9fwuhtj8khojCUzYt3itcDcfDrXwaii6fHvDDxotZAD CwZfneMoieefr5Suk7RZ+1InWfiNkUaYnqyBT4YHt3rOlSOgZUkw+VZWApjL4JMOWM iFYNqZU63M0DYz3Z3H12TY4HvAg4IDzuTNzPbIxk= Subject: FAILED: patch "[PATCH] ksmbd: fix error code overwriting in" failed to apply to 5.15-stable tree To: matvey.kovalev@ispras.ru,linkinjeon@kernel.org,stfrench@microsoft.com Cc: From: Date: Mon, 13 Oct 2025 11:15:24 +0200 Message-ID: <2025101324-echo-cardinal-3043@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit X-DKIM: signer='linuxfoundation.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linuxfoundation.org] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: 4 The patch below does not apply to the 5.15-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y git checkout FETCH_HEAD git cherry-pick -x 88daf2f448aad05a2e6df738d66fe8b0cf85cee0 # git commit -s git send-email --to '' --in-reply-to '2025101324-echo-cardinal-3043@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 88daf2f448aad05a2e6df738d66fe8b0cf85cee0 Mon Sep 17 00:00:00 2001 From: Matvey Kovalev Date: Thu, 25 Sep 2025 15:12:34 +0300 Subject: [PATCH] ksmbd: fix error code overwriting in smb2_get_info_filesystem() If client doesn't negotiate with SMB3.1.1 POSIX Extensions, then proper error code won't be returned due to overwriting. Return error immediately. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: e2f34481b24db ("cifsd: add server-side procedures for SMB3") Cc: stable@vger.kernel.org Signed-off-by: Matvey Kovalev Acked-by: Namjae Jeon Signed-off-by: Steve French diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c index 0c069eff80b7..133ca5beb7cf 100644 --- a/fs/smb/server/smb2pdu.c +++ b/fs/smb/server/smb2pdu.c @@ -5629,7 +5629,8 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work, if (!work->tcon->posix_extensions) { pr_err("client doesn't negotiate with SMB3.1.1 POSIX Extensions\n"); - rc = -EOPNOTSUPP; + path_put(&path); + return -EOPNOTSUPP; } else { info = (struct filesystem_posix_info *)(rsp->Buffer); info->OptimalTransferSize = cpu_to_le32(stfs.f_bsize); From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id 8BOxDidG7mi0dhQAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 12:46:31 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 12:46:31 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8eQA-00000006Hh6-396D for hi@josie.lol; Tue, 14 Oct 2025 12:46:31 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E42A33B599E for ; Tue, 14 Oct 2025 12:46:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 454F819F135; Tue, 14 Oct 2025 12:46:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JynGXggD" X-Original-To: stable@vger.kernel.org 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 2049615530C for ; Tue, 14 Oct 2025 12:46:24 +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=1760445985; cv=none; b=eeuobUT2SXrI0Zw4aEhOIrdBmYo9mf8xUxketxtC/RWQaxOWm21WFt7vrW//8x9SAfeyIfJxZN0vgvzL2FlAi8HEkRSlUWzpZi8SZK3QoTcbFLTqyk4TgEB1JK3EZ9IkWJ4+Lb+9TeaEJ0J83YC8L90PO1ZykmvsVE1suNNtXOY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760445985; c=relaxed/simple; bh=ZSH9lFOChPX4zffrgkcQrAV4d5+ZWVGq9A0MwAQxpI4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=q6lgQV4GuXOb3KZsPaiNIdZiv6CSO28+TPVG/hvDuUmIraWv06fMF74DEvkDsn6M9WCVr5OnlPhQZwLXgnNB1pmEiuGV206za54rZ0mLtTfhpbIcwnJIv272+jfCxvNIuzZB++tT7G/uokjruYVpkEGCC8lV1vsxK1MOWdcsn4M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JynGXggD; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0052EC4CEE7; Tue, 14 Oct 2025 12:46:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760445984; bh=ZSH9lFOChPX4zffrgkcQrAV4d5+ZWVGq9A0MwAQxpI4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JynGXggDrkVckO9f4FdYiOFt8sFVQbd9AecoP9L13SutV5AOs+ipMtUQqfFh6VYN7 SaRcaDhgTB7B9uDVfuMLp/wtjplBx8i4mbSnt6JgpFgMoMGeZL97YSSe7HMvDQXSTv Qw6bnHmmWw3+xm5Ha/QjwYTOwN/Zeq8JL/B6Wgsi94FH/1h6WaAS5+j7zCczWblCux 3w5rvMwNpyOIy3PsfX2QodOu3KMVItOoVDOsFbBPKsbUUSMaTy7iD2t8kr+K7utK6a ZKTr0AJ83doVPIQFsImqzdSSWQaoEvKnD2SNp6nW/T9yGAXn/HRKh2lRyQeAVxEkPy Nzj9CKfpAOorA== From: Sasha Levin To: stable@vger.kernel.org Cc: Yuan Chen , "Masami Hiramatsu (Google)" , Sasha Levin Subject: [PATCH 5.10.y] tracing: Fix race condition in kprobe initialization causing NULL pointer dereference Date: Tue, 14 Oct 2025 08:46:22 -0400 Message-ID: <20251014124622.3222-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2025101328-fever-giggly-7991@gregkh> References: <2025101328-fever-giggly-7991@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.2 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.2 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -11 From: Yuan Chen [ Upstream commit 9cf9aa7b0acfde7545c1a1d912576e9bab28dc6f ] There is a critical race condition in kprobe initialization that can lead to NULL pointer dereference and kernel crash. [1135630.084782] Unable to handle kernel paging request at virtual address 0000710a04630000 ... [1135630.260314] pstate: 404003c9 (nZcv DAIF +PAN -UAO) [1135630.269239] pc : kprobe_perf_func+0x30/0x260 [1135630.277643] lr : kprobe_dispatcher+0x44/0x60 [1135630.286041] sp : ffffaeff4977fa40 [1135630.293441] x29: ffffaeff4977fa40 x28: ffffaf015340e400 [1135630.302837] x27: 0000000000000000 x26: 0000000000000000 [1135630.312257] x25: ffffaf029ed108a8 x24: ffffaf015340e528 [1135630.321705] x23: ffffaeff4977fc50 x22: ffffaeff4977fc50 [1135630.331154] x21: 0000000000000000 x20: ffffaeff4977fc50 [1135630.340586] x19: ffffaf015340e400 x18: 0000000000000000 [1135630.349985] x17: 0000000000000000 x16: 0000000000000000 [1135630.359285] x15: 0000000000000000 x14: 0000000000000000 [1135630.368445] x13: 0000000000000000 x12: 0000000000000000 [1135630.377473] x11: 0000000000000000 x10: 0000000000000000 [1135630.386411] x9 : 0000000000000000 x8 : 0000000000000000 [1135630.395252] x7 : 0000000000000000 x6 : 0000000000000000 [1135630.403963] x5 : 0000000000000000 x4 : 0000000000000000 [1135630.412545] x3 : 0000710a04630000 x2 : 0000000000000006 [1135630.421021] x1 : ffffaeff4977fc50 x0 : 0000710a04630000 [1135630.429410] Call trace: [1135630.434828] kprobe_perf_func+0x30/0x260 [1135630.441661] kprobe_dispatcher+0x44/0x60 [1135630.448396] aggr_pre_handler+0x70/0xc8 [1135630.454959] kprobe_breakpoint_handler+0x140/0x1e0 [1135630.462435] brk_handler+0xbc/0xd8 [1135630.468437] do_debug_exception+0x84/0x138 [1135630.475074] el1_dbg+0x18/0x8c [1135630.480582] security_file_permission+0x0/0xd0 [1135630.487426] vfs_write+0x70/0x1c0 [1135630.493059] ksys_write+0x5c/0xc8 [1135630.498638] __arm64_sys_write+0x24/0x30 [1135630.504821] el0_svc_common+0x78/0x130 [1135630.510838] el0_svc_handler+0x38/0x78 [1135630.516834] el0_svc+0x8/0x1b0 kernel/trace/trace_kprobe.c: 1308 0xffff3df8995039ec : ldr x21, [x24,#120] include/linux/compiler.h: 294 0xffff3df8995039f0 : ldr x1, [x21,x0] kernel/trace/trace_kprobe.c 1308: head = this_cpu_ptr(call->perf_events); 1309: if (hlist_empty(head)) 1310: return 0; crash> struct trace_event_call -o struct trace_event_call { ... [120] struct hlist_head *perf_events; //(call->perf_event) ... } crash> struct trace_event_call ffffaf015340e528 struct trace_event_call { ... perf_events = 0xffff0ad5fa89f088, //this value is correct, but x21 = 0 ... } Race Condition Analysis: The race occurs between kprobe activation and perf_events initialization: CPU0 CPU1 ==== ==== perf_kprobe_init perf_trace_event_init tp_event->perf_events = list;(1) tp_event->class->reg (2)← KPROBE ACTIVE Debug exception triggers ... kprobe_dispatcher kprobe_perf_func (tk->tp.flags & TP_FLAG_PROFILE) head = this_cpu_ptr(call->perf_events)(3) (perf_events is still NULL) Problem: 1. CPU0 executes (1) assigning tp_event->perf_events = list 2. CPU0 executes (2) enabling kprobe functionality via class->reg() 3. CPU1 triggers and reaches kprobe_dispatcher 4. CPU1 checks TP_FLAG_PROFILE - condition passes (step 2 completed) 5. CPU1 calls kprobe_perf_func() and crashes at (3) because call->perf_events is still NULL CPU1 sees that kprobe functionality is enabled but does not see that perf_events has been assigned. Add pairing read and write memory barriers to guarantee that if CPU1 sees that kprobe functionality is enabled, it must also see that perf_events has been assigned. Link: https://lore.kernel.org/all/20251001022025.44626-1-chenyuan_fl@163.com/ Fixes: 50d780560785 ("tracing/kprobes: Add probe handler dispatcher to support perf and ftrace concurrent use") Cc: stable@vger.kernel.org Signed-off-by: Yuan Chen Signed-off-by: Masami Hiramatsu (Google) [ Dropped ftrace changes + context ] Signed-off-by: Sasha Levin --- kernel/trace/trace_kprobe.c | 11 +++++++---- kernel/trace/trace_probe.h | 9 +++++++-- kernel/trace/trace_uprobe.c | 12 ++++++++---- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index 646109d389e92..044df6073211e 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -1782,14 +1782,15 @@ static int kprobe_register(struct trace_event_call *event, static int kprobe_dispatcher(struct kprobe *kp, struct pt_regs *regs) { struct trace_kprobe *tk = container_of(kp, struct trace_kprobe, rp.kp); + unsigned int flags = trace_probe_load_flag(&tk->tp); int ret = 0; raw_cpu_inc(*tk->nhit); - if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) kprobe_trace_func(tk, regs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret = kprobe_perf_func(tk, regs); #endif return ret; @@ -1800,13 +1801,15 @@ static int kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) { struct trace_kprobe *tk = container_of(ri->rp, struct trace_kprobe, rp); + unsigned int flags; raw_cpu_inc(*tk->nhit); - if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tk->tp); + if (flags & TP_FLAG_TRACE) kretprobe_trace_func(tk, ri, regs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) kretprobe_perf_func(tk, ri, regs); #endif return 0; /* We don't tweek kernel, so just return 0 */ diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h index 22c05ca977587..9be69ba07cd28 100644 --- a/kernel/trace/trace_probe.h +++ b/kernel/trace/trace_probe.h @@ -251,16 +251,21 @@ struct event_file_link { struct list_head list; }; +static inline unsigned int trace_probe_load_flag(struct trace_probe *tp) +{ + return smp_load_acquire(&tp->event->flags); +} + static inline bool trace_probe_test_flag(struct trace_probe *tp, unsigned int flag) { - return !!(tp->event->flags & flag); + return !!(trace_probe_load_flag(tp) & flag); } static inline void trace_probe_set_flag(struct trace_probe *tp, unsigned int flag) { - tp->event->flags |= flag; + smp_store_release(&tp->event->flags, tp->event->flags | flag); } static inline void trace_probe_clear_flag(struct trace_probe *tp, diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index 60ff36f5d7f9e..fd40018813557 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c @@ -1484,6 +1484,7 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs) struct uprobe_dispatch_data udd; struct uprobe_cpu_buffer *ucb; int dsize, esize; + unsigned int flags; int ret = 0; @@ -1504,11 +1505,12 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs) ucb = uprobe_buffer_get(); store_trace_args(ucb->buf, &tu->tp, regs, esize, dsize); - if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tu->tp); + if (flags & TP_FLAG_TRACE) ret |= uprobe_trace_func(tu, regs, ucb, dsize); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret |= uprobe_perf_func(tu, regs, ucb, dsize); #endif uprobe_buffer_put(ucb); @@ -1522,6 +1524,7 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, struct uprobe_dispatch_data udd; struct uprobe_cpu_buffer *ucb; int dsize, esize; + unsigned int flags; tu = container_of(con, struct trace_uprobe, consumer); @@ -1539,11 +1542,12 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, ucb = uprobe_buffer_get(); store_trace_args(ucb->buf, &tu->tp, regs, esize, dsize); - if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tu->tp); + if (flags & TP_FLAG_TRACE) uretprobe_trace_func(tu, func, regs, ucb, dsize); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) uretprobe_perf_func(tu, func, regs, ucb, dsize); #endif uprobe_buffer_put(ucb); -- 2.51.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id QPJ5Icm37GgyNQcAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 08:26:49 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 08:26:49 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8DtI-000000022pN-3t8g for hi@josie.lol; Mon, 13 Oct 2025 08:26:49 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2432E1899165 for ; Mon, 13 Oct 2025 08:27:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DF5FE2F290C; Mon, 13 Oct 2025 08:26:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="MRUswEaS" X-Original-To: stable@vger.kernel.org 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 BB0D02EFDAC for ; Mon, 13 Oct 2025 08:26:34 +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=1760343994; cv=none; b=EeRDkjFyQLagyNhTaseuihuR3iAWgyUogo264X1UdnuI64d5jNqteciySDd3kuaD4nDV1rfO0wZRGtCcfJEJO+tMQpcN0sL/GBXi8FWT5KSGDYTI8QPXINFy0xwIKU1Qwz/EUur5xb4zTuuaIqO4bXiqspdEYIft2eHvwEfi1Kc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760343994; c=relaxed/simple; bh=VZB4CtfVJ4D0oXa4gHDAQR92LRlamVwBQ9D6wF3ssJY=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=qQWGV/x0siZyMUe60i9Da6GzJJYcZ2wp7nDZ7YL1wuXhdHKr01wZGNSdZ63CXLSLkNXJeCHv4RjBBHRH6rA8Riwe1yXYi7+vJKXCykMFLmMF8SflPST2ThTcE69C4ypfdd4Cdo0qtEl4StNRI6ulgR5FSQaaT+rGOTI+TFqBLUw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=MRUswEaS; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16A13C4CEE7; Mon, 13 Oct 2025 08:26:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760343994; bh=VZB4CtfVJ4D0oXa4gHDAQR92LRlamVwBQ9D6wF3ssJY=; h=Subject:To:Cc:From:Date:From; b=MRUswEaS/XzTI9PlkK6IjvskcxbAg90T6ihnqU3Mj1siw/NFaVQVGMfx5atIiMkyY 2s1kTCueprom3RxeZG2Lev82Mc/K3InbpL6FmpO4YjVU0FwG1mM92L2mEZsYJUynmo 0RVz3lw+8V8Twjughg0L+ykOdck+820ybi/5gF9k= Subject: FAILED: patch "[PATCH] tracing: Fix race condition in kprobe initialization causing" failed to apply to 5.10-stable tree To: chenyuan@kylinos.cn,mhiramat@kernel.org Cc: From: Date: Mon, 13 Oct 2025 10:26:28 +0200 Message-ID: <2025101328-fever-giggly-7991@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-DKIM: signer='linuxfoundation.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linuxfoundation.org] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [147.75.80.249 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -18 The patch below does not apply to the 5.10-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y git checkout FETCH_HEAD git cherry-pick -x 9cf9aa7b0acfde7545c1a1d912576e9bab28dc6f # git commit -s git send-email --to '' --in-reply-to '2025101328-fever-giggly-7991@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 9cf9aa7b0acfde7545c1a1d912576e9bab28dc6f Mon Sep 17 00:00:00 2001 From: Yuan Chen Date: Wed, 1 Oct 2025 03:20:25 +0100 Subject: [PATCH] tracing: Fix race condition in kprobe initialization causing NULL pointer dereference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is a critical race condition in kprobe initialization that can lead to NULL pointer dereference and kernel crash. [1135630.084782] Unable to handle kernel paging request at virtual address 0000710a04630000 ... [1135630.260314] pstate: 404003c9 (nZcv DAIF +PAN -UAO) [1135630.269239] pc : kprobe_perf_func+0x30/0x260 [1135630.277643] lr : kprobe_dispatcher+0x44/0x60 [1135630.286041] sp : ffffaeff4977fa40 [1135630.293441] x29: ffffaeff4977fa40 x28: ffffaf015340e400 [1135630.302837] x27: 0000000000000000 x26: 0000000000000000 [1135630.312257] x25: ffffaf029ed108a8 x24: ffffaf015340e528 [1135630.321705] x23: ffffaeff4977fc50 x22: ffffaeff4977fc50 [1135630.331154] x21: 0000000000000000 x20: ffffaeff4977fc50 [1135630.340586] x19: ffffaf015340e400 x18: 0000000000000000 [1135630.349985] x17: 0000000000000000 x16: 0000000000000000 [1135630.359285] x15: 0000000000000000 x14: 0000000000000000 [1135630.368445] x13: 0000000000000000 x12: 0000000000000000 [1135630.377473] x11: 0000000000000000 x10: 0000000000000000 [1135630.386411] x9 : 0000000000000000 x8 : 0000000000000000 [1135630.395252] x7 : 0000000000000000 x6 : 0000000000000000 [1135630.403963] x5 : 0000000000000000 x4 : 0000000000000000 [1135630.412545] x3 : 0000710a04630000 x2 : 0000000000000006 [1135630.421021] x1 : ffffaeff4977fc50 x0 : 0000710a04630000 [1135630.429410] Call trace: [1135630.434828] kprobe_perf_func+0x30/0x260 [1135630.441661] kprobe_dispatcher+0x44/0x60 [1135630.448396] aggr_pre_handler+0x70/0xc8 [1135630.454959] kprobe_breakpoint_handler+0x140/0x1e0 [1135630.462435] brk_handler+0xbc/0xd8 [1135630.468437] do_debug_exception+0x84/0x138 [1135630.475074] el1_dbg+0x18/0x8c [1135630.480582] security_file_permission+0x0/0xd0 [1135630.487426] vfs_write+0x70/0x1c0 [1135630.493059] ksys_write+0x5c/0xc8 [1135630.498638] __arm64_sys_write+0x24/0x30 [1135630.504821] el0_svc_common+0x78/0x130 [1135630.510838] el0_svc_handler+0x38/0x78 [1135630.516834] el0_svc+0x8/0x1b0 kernel/trace/trace_kprobe.c: 1308 0xffff3df8995039ec : ldr x21, [x24,#120] include/linux/compiler.h: 294 0xffff3df8995039f0 : ldr x1, [x21,x0] kernel/trace/trace_kprobe.c 1308: head = this_cpu_ptr(call->perf_events); 1309: if (hlist_empty(head)) 1310: return 0; crash> struct trace_event_call -o struct trace_event_call { ... [120] struct hlist_head *perf_events; //(call->perf_event) ... } crash> struct trace_event_call ffffaf015340e528 struct trace_event_call { ... perf_events = 0xffff0ad5fa89f088, //this value is correct, but x21 = 0 ... } Race Condition Analysis: The race occurs between kprobe activation and perf_events initialization: CPU0 CPU1 ==== ==== perf_kprobe_init perf_trace_event_init tp_event->perf_events = list;(1) tp_event->class->reg (2)← KPROBE ACTIVE Debug exception triggers ... kprobe_dispatcher kprobe_perf_func (tk->tp.flags & TP_FLAG_PROFILE) head = this_cpu_ptr(call->perf_events)(3) (perf_events is still NULL) Problem: 1. CPU0 executes (1) assigning tp_event->perf_events = list 2. CPU0 executes (2) enabling kprobe functionality via class->reg() 3. CPU1 triggers and reaches kprobe_dispatcher 4. CPU1 checks TP_FLAG_PROFILE - condition passes (step 2 completed) 5. CPU1 calls kprobe_perf_func() and crashes at (3) because call->perf_events is still NULL CPU1 sees that kprobe functionality is enabled but does not see that perf_events has been assigned. Add pairing read and write memory barriers to guarantee that if CPU1 sees that kprobe functionality is enabled, it must also see that perf_events has been assigned. Link: https://lore.kernel.org/all/20251001022025.44626-1-chenyuan_fl@163.com/ Fixes: 50d780560785 ("tracing/kprobes: Add probe handler dispatcher to support perf and ftrace concurrent use") Cc: stable@vger.kernel.org Signed-off-by: Yuan Chen Signed-off-by: Masami Hiramatsu (Google) diff --git a/kernel/trace/trace_fprobe.c b/kernel/trace/trace_fprobe.c index b36ade43d4b3..ad9d6347b5fa 100644 --- a/kernel/trace/trace_fprobe.c +++ b/kernel/trace/trace_fprobe.c @@ -522,13 +522,14 @@ static int fentry_dispatcher(struct fprobe *fp, unsigned long entry_ip, void *entry_data) { struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp); + unsigned int flags = trace_probe_load_flag(&tf->tp); int ret = 0; - if (trace_probe_test_flag(&tf->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) fentry_trace_func(tf, entry_ip, fregs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tf->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret = fentry_perf_func(tf, entry_ip, fregs); #endif return ret; @@ -540,11 +541,12 @@ static void fexit_dispatcher(struct fprobe *fp, unsigned long entry_ip, void *entry_data) { struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp); + unsigned int flags = trace_probe_load_flag(&tf->tp); - if (trace_probe_test_flag(&tf->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) fexit_trace_func(tf, entry_ip, ret_ip, fregs, entry_data); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tf->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) fexit_perf_func(tf, entry_ip, ret_ip, fregs, entry_data); #endif } diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index fa60362a3f31..ee8171b19bee 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -1815,14 +1815,15 @@ static int kprobe_register(struct trace_event_call *event, static int kprobe_dispatcher(struct kprobe *kp, struct pt_regs *regs) { struct trace_kprobe *tk = container_of(kp, struct trace_kprobe, rp.kp); + unsigned int flags = trace_probe_load_flag(&tk->tp); int ret = 0; raw_cpu_inc(*tk->nhit); - if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) kprobe_trace_func(tk, regs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret = kprobe_perf_func(tk, regs); #endif return ret; @@ -1834,6 +1835,7 @@ kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) { struct kretprobe *rp = get_kretprobe(ri); struct trace_kprobe *tk; + unsigned int flags; /* * There is a small chance that get_kretprobe(ri) returns NULL when @@ -1846,10 +1848,11 @@ kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) tk = container_of(rp, struct trace_kprobe, rp); raw_cpu_inc(*tk->nhit); - if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tk->tp); + if (flags & TP_FLAG_TRACE) kretprobe_trace_func(tk, ri, regs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) kretprobe_perf_func(tk, ri, regs); #endif return 0; /* We don't tweak kernel, so just return 0 */ diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h index 842383fbc03b..08b5bda24da2 100644 --- a/kernel/trace/trace_probe.h +++ b/kernel/trace/trace_probe.h @@ -271,16 +271,21 @@ struct event_file_link { struct list_head list; }; +static inline unsigned int trace_probe_load_flag(struct trace_probe *tp) +{ + return smp_load_acquire(&tp->event->flags); +} + static inline bool trace_probe_test_flag(struct trace_probe *tp, unsigned int flag) { - return !!(tp->event->flags & flag); + return !!(trace_probe_load_flag(tp) & flag); } static inline void trace_probe_set_flag(struct trace_probe *tp, unsigned int flag) { - tp->event->flags |= flag; + smp_store_release(&tp->event->flags, tp->event->flags | flag); } static inline void trace_probe_clear_flag(struct trace_probe *tp, diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index 8b0bcc0d8f41..430d09c49462 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c @@ -1547,6 +1547,7 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs, struct trace_uprobe *tu; struct uprobe_dispatch_data udd; struct uprobe_cpu_buffer *ucb = NULL; + unsigned int flags; int ret = 0; tu = container_of(con, struct trace_uprobe, consumer); @@ -1561,11 +1562,12 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs, if (WARN_ON_ONCE(!uprobe_cpu_buffer)) return 0; - if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tu->tp); + if (flags & TP_FLAG_TRACE) ret |= uprobe_trace_func(tu, regs, &ucb); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret |= uprobe_perf_func(tu, regs, &ucb); #endif uprobe_buffer_put(ucb); @@ -1579,6 +1581,7 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, struct trace_uprobe *tu; struct uprobe_dispatch_data udd; struct uprobe_cpu_buffer *ucb = NULL; + unsigned int flags; tu = container_of(con, struct trace_uprobe, consumer); @@ -1590,11 +1593,12 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, if (WARN_ON_ONCE(!uprobe_cpu_buffer)) return 0; - if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tu->tp); + if (flags & TP_FLAG_TRACE) uretprobe_trace_func(tu, func, regs, &ucb); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) uretprobe_perf_func(tu, func, regs, &ucb); #endif uprobe_buffer_put(ucb); From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id IE16BAtG7mjc0BIAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 12:46:03 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 12:46:03 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8ePi-00000006Gyc-2scL for hi@josie.lol; Tue, 14 Oct 2025 12:46:03 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DCE173A68B7 for ; Tue, 14 Oct 2025 12:46:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9F3AC288C13; Tue, 14 Oct 2025 12:45:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SIOhET1l" X-Original-To: io-uring@vger.kernel.org Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A6DC22EB85B for ; Tue, 14 Oct 2025 12:45:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760445945; cv=none; b=K3z+Suu1qvF+PJa9a+SCUuEcGzrNEmF/Mh7I/sO2FD9FWDFgtnWvas0TzsQLuNuG+0v8uW1+Lwo+yGWcAGNVMFqvb4BgSCt1BNJV3KnPyOZEJcCShvM2hjo6GmCk8ZIpcEuGJD9HW+4KBZVAkaAdT1rAkPcFpiu5cqZUKibZckc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760445945; c=relaxed/simple; bh=4xAZty85ZHdvBE6Q6Ju6E8/SyfTuwcvhqmJQ6fWLs54=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=MML+WKkH9DF/h8FasccFhmzSIp5NwBwnK14GrampOYYbRhrFMLMBMN4hnnXbfstpzopAPQg4b2qQtHT1L3e/bfV1w030MmtEey+D0DrxBnrAWMzVCIRftYeshsGY3B4pUfPh2lKnWAoJcIjyzfD5bkv8AIoZWr8OB8eXCjuW9qI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=SIOhET1l; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-46e430494ccso30470395e9.1 for ; Tue, 14 Oct 2025 05:45:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760445942; x=1761050742; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=t+s+MnUCBJ5Abbhdfz+BBRkABbDhDMVmHDHwHoH2l6Q=; b=SIOhET1lP1CVEl97faPGO0VQp8rByWy78RyyTQJ62a5gycXaEFN4W95RDO+019HH7D U9fSHg0ptn4JjIuGHDt23ae5jN9cs6Lf4wx02pqBFc1PEyn24REtWb36TUcLn4KLvq2X ZCSuti7V+4r+5smtVUQHuN0GQLO46+F5ChOtFDmbXMkbT7VPE0X73lfqU3zN7rVsPOS2 JTMoQpeedNZkxx8ITPlZzzAOqv3vZS5No6nZsD6PpJ0/vwdIqyMYTB+dZvKgXvNa4KYE 54rfafm2j6aUCD/0SeLxGBXweMg3Wbq3nqEmP9cry2nfD9U4Rb7UAilPHO43+3utCJsz mV7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760445942; x=1761050742; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=t+s+MnUCBJ5Abbhdfz+BBRkABbDhDMVmHDHwHoH2l6Q=; b=NqvrIc0WVYV3daEpjuT/yXqyZYDOGFQD3f9cuLFFp26h4Vzqd5eYLiU+oWnhFy4aAv wtEC+PUqL/eKgxkD8sYuOy3XCnQYgHO+bor8eH+muMJnC9BLJJiLtmoi7NY+H6wcJWNY LiWziOoNhYtfXCwnvgyPNwQCF6uAUorJdw4bRKOiPHJhlZ91/zVL3x/GWiukkJqBta0Q buq3DLnxyu0+cOwD5hm4lfPym9zt/YZ/IHwRyo3YPAYkwSdI4hc4AzkkLr5+FHvoeI0L CKjJ+ELOdCjTptd8AS+z78Ih8w4x0luUm8t9w+eqwt+8FdHL/7OPjaXujRsUwVR8a9DZ VF+A== X-Forwarded-Encrypted: i=1; AJvYcCWRUMrGZXVKK+umvBpJzIbku67/FK6tg502MQh2ZFnro6RYmn194+INS3Lu9NUgf8Skg+FrBYhmMg==@vger.kernel.org X-Gm-Message-State: AOJu0Yzh/V13++rY+Q6DCWjDAZAGnZ0EhaxFAr/pvU4CpsF+hk5tF81Q dvz4r/kF64V16BZd7Kosx1jQojnDioREpJSBfBykEV8I6XrMcBSDc1WK X-Gm-Gg: ASbGnctNxlrG7CfY/ZXxaiFCuWAfpCPW+EiVfywan4+h5qWQblmwbwsF7A2rc2oyzgF Y7qhJOE4br4B9wLzytdCt0khcaggs+kxhYdHN/R43Fd5iRN9Jvnm36CLnp7GzaeyEQLOs5XnB8s dyIdDBOwVITuaxSW9LnOI1VKLhNSmbMj0nTwiTThw+RaQo92tC0SHo0+/j4dgi1MYD67CBOQuaL q8GzKGTW7gkiCAE7MyUauea3X+c3/sqhrC/i3j78O1ZpGqzjj8UGe0Hn/KldKpfRJtqbpsrJ8aN h/5RtYDHzgOMGJlRj392jrAthKn8WwMt/OBqo590ZYfU245LIHW1RX8/SOOLREo81KgBLTJk/e1 gBDiLIZyL+5i+db/f5wkS6DCu1++1p3Mm57TbjUPmEUOm0rflYw5G7DbH2rLdhzxPKkwH5kJVQw v671+Zb7VQ X-Google-Smtp-Source: AGHT+IG37XYlLrmKRzsVTbT8x4wG0Ta4s90KjMR3qbRk2A+e9jHNkHgI8r+1AkdRhNxcKymiD3ZRzw== X-Received: by 2002:a05:600c:c162:b0:46e:47cc:a17e with SMTP id 5b1f17b1804b1-46fa9a8f4c8mr165749265e9.1.1760445941678; Tue, 14 Oct 2025 05:45:41 -0700 (PDT) Received: from ?IPV6:2620:10d:c096:325:77fd:1068:74c8:af87? ([2620:10d:c092:600::1:7ec0]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-46fb55ac08dsm232559785e9.13.2025.10.14.05.45.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Oct 2025 05:45:40 -0700 (PDT) Message-ID: <0ef2009e-2593-4b15-a96b-512c1dd30151@gmail.com> Date: Tue, 14 Oct 2025 13:46:56 +0100 Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v4 00/24][pull request] Queue configs and large buffer providers To: Jakub Kicinski Cc: netdev@vger.kernel.org, Andrew Lunn , davem@davemloft.net, Eric Dumazet , Paolo Abeni , Simon Horman , Donald Hunter , Michael Chan , Pavan Chebbi , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , Joshua Washington , Harshitha Ramamurthy , Jian Shen , Salil Mehta , Jijie Shao , Sunil Goutham , Geetha sowjanya , Subbaraya Sundeep , hariprasad , Bharat Bhushan , Saeed Mahameed , Tariq Toukan , Mark Bloch , Leon Romanovsky , Alexander Duyck , kernel-team@meta.com, Ilias Apalodimas , Joe Damato , David Wei , Willem de Bruijn , Mina Almasry , Breno Leitao , Dragos Tatulea , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-rdma@vger.kernel.org, Jonathan Corbet , io-uring References: <20251013105446.3efcb1b3@kernel.org> Content-Language: en-US From: Pavel Begunkov In-Reply-To: <20251013105446.3efcb1b3@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [asml.silence[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On 10/13/25 18:54, Jakub Kicinski wrote: > On Mon, 13 Oct 2025 15:54:02 +0100 Pavel Begunkov wrote: >> Jakub Kicinski (20): >> docs: ethtool: document that rx_buf_len must control payload lengths >> net: ethtool: report max value for rx-buf-len >> net: use zero value to restore rx_buf_len to default >> net: clarify the meaning of netdev_config members >> net: add rx_buf_len to netdev config >> eth: bnxt: read the page size from the adapter struct >> eth: bnxt: set page pool page order based on rx_page_size >> eth: bnxt: support setting size of agg buffers via ethtool >> net: move netdev_config manipulation to dedicated helpers >> net: reduce indent of struct netdev_queue_mgmt_ops members >> net: allocate per-queue config structs and pass them thru the queue >> API >> net: pass extack to netdev_rx_queue_restart() >> net: add queue config validation callback >> eth: bnxt: always set the queue mgmt ops >> eth: bnxt: store the rx buf size per queue >> eth: bnxt: adjust the fill level of agg queues with larger buffers >> netdev: add support for setting rx-buf-len per queue >> net: wipe the setting of deactived queues >> eth: bnxt: use queue op config validate >> eth: bnxt: support per queue configuration of rx-buf-len > > I'd like to rework these a little bit. > On reflection I don't like the single size control. > Please hold off. I think that would be quite unproductive considering that this series has been around for 3 months already with no forward progress, and the API was posted 6 months ago. I have a better idea, I'll shrink it down by removing all unnecessary parts, that makes it much much simpler and should detangle the effort from ethtool bits like Stan once suggested. I've also been bothered for some time by it growing to 24 patches, it'll help with that as well. And it'll be a good base to put all the netlink configuration bits on top if necessary. > Also what's the resolution for the maintainers entry / cross posting? I'm pretty much interested as well :) I've been CC'ing netdev as a gesture of goodwill, that's despite you blocking an unrelated series because of a rule you made up and retrospectively applied and belittling my work after. It doesn't seem that you content with it either, evidently from you blocking it again. I'm very curious what's that all about? And since you're unwilling to deal with the series, maybe you'll let other maintainers to handle it? -- Pavel Begunkov From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id kEfHMyIY7WjS+TUAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 15:17:54 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 15:17:54 +0000 Received: from ams.mirrors.kernel.org ([213.196.21.55]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8KJ8-0000000G3fr-2Mhq for hi@josie.lol; Mon, 13 Oct 2025 15:17:54 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.mirrors.kernel.org (Postfix) with ESMTPS id 66672344578 for ; Mon, 13 Oct 2025 15:17:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1061330B52C; Mon, 13 Oct 2025 15:02:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Km/+C7xs" X-Original-To: io-uring@vger.kernel.org Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B92430B51B for ; Mon, 13 Oct 2025 15:02:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760367749; cv=none; b=KCkpYDQNCHQ3UfnongUq57x6rQ/dFljLLA1EWCui6nilY/EuyLUbQvc1CM3eXz50YTX9xvDJT+se/ww4lxMjebDDmj3v2fMnldGxZfNEnn8Nud6NxCtyKwz4UdmOQzK1xWLKJWJYRIs0vp8JQ+l6r8mr/H6zGWyJ5Nh1fatdcMc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760367749; c=relaxed/simple; bh=XZ4lzHryEJQS9jgidvbUbN7osxHnfwhUvb5lDvX5gJM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=sE9V3RmWDbBjbLohiJDaB1vOyW28huyciMgdiQjpw8Ui/8pwuZLk8itbFznAVvhhbH4KzLCTROFHH7qmNT2VBGNakFl8ijAtwo3pUMfrVTnvAf8V1j92XM0yYuLVgHpF2SbMuYiWWyNlV0q7ovhPi9R/2vkcipjqwInUxDttmxs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Km/+C7xs; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-3f0ae439bc3so2017058f8f.1 for ; Mon, 13 Oct 2025 08:02:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760367746; x=1760972546; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Yh3tjmmjbgFKGhBWocvc5VFMFhZLywRMRFtzLSkbw0s=; b=Km/+C7xsfZItqUK1cRI41oQudCJQXawtSlxm2Y90QzKe9b1CH9Lue/2I7UhiV9ElL/ QbsSPdkyMDOFYhdArM/WwUk4HrRd78V3RT1IKtSrA3tojPLDyJJgw1uFNjhsOatstdjf awHA8HXlg+4SOEZ9oEI0WYufnhqiDxH7H1pDa2kElbVfVK/isv9w6THHMeFYOFdsTzrT 4XPM6rT28Dtw7BCO5UlxgNQd6gurCk9yoS6p4GVG3DiwKS/kZXmT1g4FH0o84SKujCvj NNq3v1ken4Lh0yVIZ4HeRdWXMC3yki6pD6VwCI9gK9RKdT3vhvmYDl93+WFdT69sWhcP DVaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760367746; x=1760972546; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Yh3tjmmjbgFKGhBWocvc5VFMFhZLywRMRFtzLSkbw0s=; b=hEn2PDlG+y1WrUXuww8PrUpCQBo9f2O7h8U0Ll3Ls7qRZRneNEUqXWIwpNtv0ECP26 NQReU7hdQPYGw+f9PKQsj/MsCVTF1+CVSreBzD+fO01pbX8QCh1Rnj6DYQv4NuTpmmim FkRbB10BHLdiQfEei2GM8hy5YfVaK6eKdiZVUHrzeT1jSeb5RveKYIC4TuTuS9cupy9N XpbIWfGL03RNRrv3BG2h4Os/8D+472lpY0efQBrBTBmPiw1B/iiQkVuxFxeD7Gb1ymQ/ 4u0d2VGjn6oVvAWVvcticCeOhfEvM8A9Ec+uTXhT6TyW9DhKKClziePaZJphHn/XeOx2 AbPA== X-Forwarded-Encrypted: i=1; AJvYcCUjnYpOeKElVKJ5MiEiiSZHu7SuyPWvCQxdB8s58pXULqM/5IujuTsVW2imTt6YIfUEphc0Zqn3BA==@vger.kernel.org X-Gm-Message-State: AOJu0Yxiiftzvw1z1mIihWZJER28x1FfTOQG74l9ev9x0wZcdM9Oc3wn 2ps/Zdwr1DgKdRItC7y9V+/nSbVzPs/kWqizCbS8HwzUf1mRnuupecTp X-Gm-Gg: ASbGncvblEQN9tQGdJ/VLYajXWQa9zkeFa721BLHrxgk11EdIZmqMbWVOGgckt/jVf2 yovKG/2RumINnzbjF3i+ZIP/4XJqpFn9Bi+x8rpVKmpzvcVxvjqOIGT25sZ4zIrJLp9zvRP4FTp 8s7bG5yUFUj5TYbj7WJPZg8AngubmQKw7Zw6WOCEzMt0GRCKYKQoZG/WONYESbn+h/UMNOPHAO1 /mmyGoVAhoPwB947ojvK05c5u6zLObKMQzLti+LtKTxIdIt4hB4knG0mt1kx5r/R4bZkhw+9cAu XuEMvJ0Ub0RAaZghRs8Ioau4cGoIV996BNo4QJK+y1ZG3Jqyqjm/2myq0lStsUbYy/KuJ/I608q JVIdLWA5yc3VaWrCvcMiybi50esJiAgaCWZ38X3HlDH5trWh9JuKDaTsZ3w0ECwKAAM6j/sbV3W AWDiSi5Hlm X-Google-Smtp-Source: AGHT+IGNkJ4QbgL7tRzgvPN+I8L7UO5FdEYBSf53xVmGqianIIUKzVvqoD7JkSPO2wQpbIF5bLMK1Q== X-Received: by 2002:a05:6000:491e:b0:426:d549:5861 with SMTP id ffacd0b85a97d-426d5495947mr6222761f8f.42.1760367745998; Mon, 13 Oct 2025 08:02:25 -0700 (PDT) Received: from ?IPV6:2620:10d:c096:325:77fd:1068:74c8:af87? ([2620:10d:c092:600::1:eb09]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-426ce583664sm18651180f8f.22.2025.10.13.08.02.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Oct 2025 08:02:24 -0700 (PDT) Message-ID: Date: Mon, 13 Oct 2025 16:03:40 +0100 Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v4 00/24][pull request] Queue configs and large buffer providers To: netdev@vger.kernel.org Cc: Andrew Lunn , Jakub Kicinski , davem@davemloft.net, Eric Dumazet , Paolo Abeni , Simon Horman , Donald Hunter , Michael Chan , Pavan Chebbi , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , Joshua Washington , Harshitha Ramamurthy , Jian Shen , Salil Mehta , Jijie Shao , Sunil Goutham , Geetha sowjanya , Subbaraya Sundeep , hariprasad , Bharat Bhushan , Saeed Mahameed , Tariq Toukan , Mark Bloch , Leon Romanovsky , Alexander Duyck , kernel-team@meta.com, Ilias Apalodimas , Joe Damato , David Wei , Willem de Bruijn , Mina Almasry , Breno Leitao , Dragos Tatulea , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-rdma@vger.kernel.org, Jonathan Corbet , io-uring References: Content-Language: en-US From: Pavel Begunkov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [213.196.21.55 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [asml.silence[at]gmail.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On 10/13/25 15:54, Pavel Begunkov wrote: Forgot to CC io_uring > Add support for per-queue rx buffer length configuration based on [2] > and basic infrastructure for using it in memory providers like > io_uring/zcrx. Note, it only includes net/ patches and leaves out > zcrx to be merged separately. Large rx buffers can be beneficial with > hw-gro enabled cards that can coalesce traffic, which reduces the > number of frags traversing the network stack and resuling in larger > contiguous chunks of data given to the userspace. Same note as the last time, not great that it's over the 15 patches, but I don't see a good way to shrink it considering that the original series [2] is 22 patches long, and I'll somehow need to pull it it into the io_uring tree after. Please let me know if there is a strong feeling about that, and/or what would the preferred way be. -- Pavel Begunkov From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id kAyMO7VH7miFLgwAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 12:53:09 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 12:53:10 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8eWb-00000006XBu-284a for hi@josie.lol; Tue, 14 Oct 2025 12:53:09 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6ACBF3E2BE9 for ; Tue, 14 Oct 2025 12:53:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DFE7B30C62B; Tue, 14 Oct 2025 12:53:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PhVslwbw" X-Original-To: stable@vger.kernel.org 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 B09F719F135; Tue, 14 Oct 2025 12:53:04 +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=1760446384; cv=none; b=TVnDAcXOTmhQPZqzcz9ctNsQONX5+yveTUn94w5n1pTL7xQyDOVrJfpAkC7PwpTlNQOiFr/K7AJGztBirNfdQzzFnoA8EM25QJOj11NPDiQpfyelLm/Qv6ouRL9Hc8q+lC5QR8N9hvC7fwbepIRoAJ5jYtFtUTtUOQCuTarux2Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760446384; c=relaxed/simple; bh=3GR/5lTiZpzFVFt2Z1xJkc1y4Tls8IQavDcFRWUvTRc=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=byg8ZJNcKWbthBLII1PFc/886M3lH5WbNaqhwqFMP4zDSIE2DPHcJLjJ10hOYYcSbq3iYRCWRzLWgi4jltY3MhU/TrGiWjjTjLvZ0eA9dd2mKWKpAjnYwkfjL2Tmr7xwbZ/ZG9QPmaUU/uqW1XhaRD9lFcGQV5CVuutRcC7e9ok= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PhVslwbw; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA73DC4CEE7; Tue, 14 Oct 2025 12:53:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760446384; bh=3GR/5lTiZpzFVFt2Z1xJkc1y4Tls8IQavDcFRWUvTRc=; h=Date:From:Subject:To:Cc:References:In-Reply-To:From; b=PhVslwbwgYifj4TIVXipJqxqzCyBnRxQoMTQEtIrZNOMTYC5cYVPAp09chqJHy8Hw bWPh7v/B0uN9wjnh5pbl97WEpIiuDOfEU/dZJivv6Im3lUEHYygQIdShsu1H8jQSz5 hxpvviXxGu2hP/YOuJwMTsaIZQimcBjeXJeu+2MepaJwWMuqi61xt8ID0eN/qrYvan SPpVWHBNbITy0pwyzLHRIjhTeNvtM+TGa8bkUVd/OCVeHT5426N4DRJTITqWWvt4aX vCb9GTfxcW1oDcRGI6PSeGbFF5CgrbTWGWU7iXXh/VYJjhiHvJm7mQRu3nFPepM1Lm ZTLCaE97Vd1SQ== Message-ID: <54a970ec-6c06-4544-babb-7ad30a011ad9@kernel.org> Date: Tue, 14 Oct 2025 14:53:01 +0200 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Hans Verkuil Subject: Re: [PATCH v4 1/2] media: cx18: Fix invalid access to file * To: Jacopo Mondi , Andy Walls , Mauro Carvalho Chehab , Laurent Pinchart Cc: Dan Carpenter , stable@vger.kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org References: <20250819-cx18-v4l2-fh-v4-0-9db1635d6787@ideasonboard.com> <20250819-cx18-v4l2-fh-v4-1-9db1635d6787@ideasonboard.com> Content-Language: en-US, nl In-Reply-To: <20250819-cx18-v4l2-fh-v4-1-9db1635d6787@ideasonboard.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.2 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.2 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: fh.cx] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -11 On 19/08/2025 09:07, Jacopo Mondi wrote: > Sice commit 7b9eb53e8591 ("media: cx18: Access v4l2_fh from file") > all ioctl handlers have been ported to operate on the file * first > function argument. > > The cx18 DVB layer calls cx18_init_on_first_open() when the driver needs > to start streaming. This function calls the s_input(), s_std() and > s_frequency() ioctl handlers directly, but being called from the driver > context, it doesn't have a valid file * to pass them. This causes > the ioctl handlers to deference an invalid pointer. > > Fix this by moving the implementation of those ioctls to functions that > take a cx18 pointer instead of a file pointer, and turn the V4L2 ioctl > handlers into wrappers that get the cx18 from the file. When calling > from cx18_init_on_first_open(), pass the cx18 pointer directly. This > allows removing the fake fh in cx18_init_on_first_open(). > > The bug has been reported by Smatch: > > --> 1223 cx18_s_input(NULL, &fh, video_input); > The patch adds a new dereference of "file" but some of the callers pass a > NULL pointer. > > Reported-by: Dan Carpenter > Closes: https://lore.kernel.org/all/aKL4OMWsESUdX8KQ@stanley.mountain/ > Fixes: 7b9eb53e8591 ("media: cx18: Access v4l2_fh from file") > Cc: stable@vger.kernel.org > Link: https://lore.kernel.org/stable/20250818-cx18-v4l2-fh-v1-1-6fe153760bce%40ideasonboard.com > Reviewed-by: Laurent Pinchart > Signed-off-by: Jacopo Mondi Tested-by: Hans Verkuil Regards, Hans > --- > drivers/media/pci/cx18/cx18-driver.c | 9 +++------ > drivers/media/pci/cx18/cx18-ioctl.c | 30 +++++++++++++++++++----------- > drivers/media/pci/cx18/cx18-ioctl.h | 8 +++++--- > 3 files changed, 27 insertions(+), 20 deletions(-) > > diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c > index 743fcc9613744bfc1edeffc51e908fe88520405a..cd84dfcefcf971a7adb9aac2bafb9089dbe0f33f 100644 > --- a/drivers/media/pci/cx18/cx18-driver.c > +++ b/drivers/media/pci/cx18/cx18-driver.c > @@ -1136,11 +1136,8 @@ int cx18_init_on_first_open(struct cx18 *cx) > int video_input; > int fw_retry_count = 3; > struct v4l2_frequency vf; > - struct cx18_open_id fh; > v4l2_std_id std; > > - fh.cx = cx; > - > if (test_bit(CX18_F_I_FAILED, &cx->i_flags)) > return -ENXIO; > > @@ -1220,14 +1217,14 @@ int cx18_init_on_first_open(struct cx18 *cx) > > video_input = cx->active_input; > cx->active_input++; /* Force update of input */ > - cx18_s_input(NULL, &fh, video_input); > + cx18_do_s_input(cx, video_input); > > /* Let the VIDIOC_S_STD ioctl do all the work, keeps the code > in one place. */ > cx->std++; /* Force full standard initialization */ > std = (cx->tuner_std == V4L2_STD_ALL) ? V4L2_STD_NTSC_M : cx->tuner_std; > - cx18_s_std(NULL, &fh, std); > - cx18_s_frequency(NULL, &fh, &vf); > + cx18_do_s_std(cx, std); > + cx18_do_s_frequency(cx, &vf); > return 0; > } > > diff --git a/drivers/media/pci/cx18/cx18-ioctl.c b/drivers/media/pci/cx18/cx18-ioctl.c > index bf16d36448f888d9326b5f4a8f9c8f0e13d0c3a1..6e869c43cbd520feb720a71d8eb2dd60c05b0ae9 100644 > --- a/drivers/media/pci/cx18/cx18-ioctl.c > +++ b/drivers/media/pci/cx18/cx18-ioctl.c > @@ -521,10 +521,8 @@ static int cx18_g_input(struct file *file, void *fh, unsigned int *i) > return 0; > } > > -int cx18_s_input(struct file *file, void *fh, unsigned int inp) > +int cx18_do_s_input(struct cx18 *cx, unsigned int inp) > { > - struct cx18_open_id *id = file2id(file); > - struct cx18 *cx = id->cx; > v4l2_std_id std = V4L2_STD_ALL; > const struct cx18_card_video_input *card_input = > cx->card->video_inputs + inp; > @@ -558,6 +556,11 @@ int cx18_s_input(struct file *file, void *fh, unsigned int inp) > return 0; > } > > +static int cx18_s_input(struct file *file, void *fh, unsigned int inp) > +{ > + return cx18_do_s_input(file2id(file)->cx, inp); > +} > + > static int cx18_g_frequency(struct file *file, void *fh, > struct v4l2_frequency *vf) > { > @@ -570,11 +573,8 @@ static int cx18_g_frequency(struct file *file, void *fh, > return 0; > } > > -int cx18_s_frequency(struct file *file, void *fh, const struct v4l2_frequency *vf) > +int cx18_do_s_frequency(struct cx18 *cx, const struct v4l2_frequency *vf) > { > - struct cx18_open_id *id = file2id(file); > - struct cx18 *cx = id->cx; > - > if (vf->tuner != 0) > return -EINVAL; > > @@ -585,6 +585,12 @@ int cx18_s_frequency(struct file *file, void *fh, const struct v4l2_frequency *v > return 0; > } > > +static int cx18_s_frequency(struct file *file, void *fh, > + const struct v4l2_frequency *vf) > +{ > + return cx18_do_s_frequency(file2id(file)->cx, vf); > +} > + > static int cx18_g_std(struct file *file, void *fh, v4l2_std_id *std) > { > struct cx18 *cx = file2id(file)->cx; > @@ -593,11 +599,8 @@ static int cx18_g_std(struct file *file, void *fh, v4l2_std_id *std) > return 0; > } > > -int cx18_s_std(struct file *file, void *fh, v4l2_std_id std) > +int cx18_do_s_std(struct cx18 *cx, v4l2_std_id std) > { > - struct cx18_open_id *id = file2id(file); > - struct cx18 *cx = id->cx; > - > if ((std & V4L2_STD_ALL) == 0) > return -EINVAL; > > @@ -642,6 +645,11 @@ int cx18_s_std(struct file *file, void *fh, v4l2_std_id std) > return 0; > } > > +static int cx18_s_std(struct file *file, void *fh, v4l2_std_id std) > +{ > + return cx18_do_s_std(file2id(file)->cx, std); > +} > + > static int cx18_s_tuner(struct file *file, void *fh, const struct v4l2_tuner *vt) > { > struct cx18_open_id *id = file2id(file); > diff --git a/drivers/media/pci/cx18/cx18-ioctl.h b/drivers/media/pci/cx18/cx18-ioctl.h > index 221e2400fb3e2d817eaff7515fa89eb94f2d7f8a..7a42ac99312ab6502e1abe4f3d5c88c9c7f144f3 100644 > --- a/drivers/media/pci/cx18/cx18-ioctl.h > +++ b/drivers/media/pci/cx18/cx18-ioctl.h > @@ -12,6 +12,8 @@ u16 cx18_service2vbi(int type); > void cx18_expand_service_set(struct v4l2_sliced_vbi_format *fmt, int is_pal); > u16 cx18_get_service_set(struct v4l2_sliced_vbi_format *fmt); > void cx18_set_funcs(struct video_device *vdev); > -int cx18_s_std(struct file *file, void *fh, v4l2_std_id std); > -int cx18_s_frequency(struct file *file, void *fh, const struct v4l2_frequency *vf); > -int cx18_s_input(struct file *file, void *fh, unsigned int inp); > + > +struct cx18; > +int cx18_do_s_std(struct cx18 *cx, v4l2_std_id std); > +int cx18_do_s_frequency(struct cx18 *cx, const struct v4l2_frequency *vf); > +int cx18_do_s_input(struct cx18 *cx, unsigned int inp); > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id EDvGFklD7mhrOxUAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 12:34:17 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 12:34:17 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8eEK-00000005tok-3fSf for hi@josie.lol; Tue, 14 Oct 2025 12:34:17 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6B20D19275F8 for ; Tue, 14 Oct 2025 12:34:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 56F47307ACC; Tue, 14 Oct 2025 12:34:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gQF0Y6dc" X-Original-To: stable@vger.kernel.org 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 2B0DD2DE1E5; Tue, 14 Oct 2025 12:34:12 +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=1760445253; cv=none; b=EjHtIjhaKt7aAjMEEg9H4VEPbm6SeHRRR0NyD/o5F/lewtBkeyqorm4BXeGJRv8d2K+hr7N3rmIjTZMbKyre64WFqlBNRIqVbDV0i29ur6/wmlrKcC1V+y1dmBB5pzjghRNWZK/OAfLi/4Ar0Xb73lDuGsW6Gv61KXpzFg0g9V0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760445253; c=relaxed/simple; bh=GNg0lILA/EASTwnAkarlJXxI1zxHDTzHg9YaU1hS5Fs=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=aVtbN/GcOOHIfoCvpEedzoFQVjZPVSrcG2CGszufUwQqPXKl/9sm8mj5rUVZWCrKV8VHCJpNaI/6bWZLeZBc5fD/SAYEvgS6h6u5Xp4atQZxws4G3MaQfMqDXAC36iy9YvNG29clSOEys4SWrN7Zq24L7G/aBShTKfRFD4hYRiA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gQF0Y6dc; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFDC7C4CEE7; Tue, 14 Oct 2025 12:34:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760445252; bh=GNg0lILA/EASTwnAkarlJXxI1zxHDTzHg9YaU1hS5Fs=; h=Date:From:Subject:To:Cc:References:In-Reply-To:From; b=gQF0Y6dcezXj0XBhp91YKYvi6f9489AxB6hJ2RzpGKbxAOs+lIXrw1+A0M52+Lio1 iUnRwEDWz8+uYRtl+suOLv5dVv/XZfACvXqiVkqPJGyB84RMxTS/TKczE0n+ryYhsF NHoeQscfnARH1SakGvOlJ2iGlIMV+yDeSxK1SpQFojS9Qvy1/vyjJGWUlIMyEsKGES IL0rVeEmfP8oCqzsP7E+iwps1RRK97eGBr6sPMS9HeK9Nvk9OIL98ON+ume1cR/fWy 7d3wseqIuK7FJ24j8rhUt4nH+K3Qwpgux3TOfEWmp4/qMq8ikm6AVarGOHM5CNkPdc a8fu3pevkG3CA== Message-ID: Date: Tue, 14 Oct 2025 14:34:09 +0200 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Hans Verkuil Subject: Re: [PATCH v4 2/2] media: ivtv: Fix invalid access to file * To: Jacopo Mondi , Andy Walls , Mauro Carvalho Chehab , Laurent Pinchart Cc: Dan Carpenter , stable@vger.kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org References: <20250819-cx18-v4l2-fh-v4-0-9db1635d6787@ideasonboard.com> <20250819-cx18-v4l2-fh-v4-2-9db1635d6787@ideasonboard.com> Content-Language: en-US, nl In-Reply-To: <20250819-cx18-v4l2-fh-v4-2-9db1635d6787@ideasonboard.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -3.5 (---) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-3.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [147.75.80.249 listed in list.dnswl.org] 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: fh.itv] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -34 On 19/08/2025 09:07, Jacopo Mondi wrote: > Since commit 9ba9d11544f9 ("media: ivtv: Access v4l2_fh from file") > all ioctl handlers have been ported to operate on the file * first > function argument. > > The ivtv DVB layer calls ivtv_init_on_first_open() when the driver > needs to start streaming. This function calls the s_input() and > s_frequency() ioctl handlers directly, but being called from the driver > context, it doesn't have a valid file * to pass them. This causes the > ioctl handlers to deference an invalid pointer. > > Fix this by moving the implementation of those ioctls to two helper > functions. > > The ivtv_do_s_input() helper accepts a struct ivtv * as first argument, > which is easily accessible in ivtv_init_on_first_open() as well as from > the file * argument of the ioctl handler. > > The ivtv_s_frequency() takes an ivtv_stream * instead. The stream * can > safely be accessed in ivtv_init_on_first_open() where it is hard-coded > to the IVTV_ENC_STREAM_TYPE_MPG stream type, as well as from the ioctl > handler as a valid stream type is associated to each open file handle > depending on which video device node has been opened in the ivtv_open() > file operation. > > The bug has been reported by Smatch. > > Reported-by: Dan Carpenter > Closes: https://lore.kernel.org/all/aKL4OMWsESUdX8KQ@stanley.mountain/ > Fixes: 9ba9d11544f9 ("media: ivtv: Access v4l2_fh from file") > Cc: stable@vger.kernel.org > Reviewed-by: Laurent Pinchart > Signed-off-by: Jacopo Mondi Tested-by: Hans Verkuil I'll try the cx18 board next :-) Regards, Hans > --- > drivers/media/pci/ivtv/ivtv-driver.c | 11 ++++------- > drivers/media/pci/ivtv/ivtv-ioctl.c | 22 +++++++++++++++++----- > drivers/media/pci/ivtv/ivtv-ioctl.h | 6 ++++-- > 3 files changed, 25 insertions(+), 14 deletions(-) > > diff --git a/drivers/media/pci/ivtv/ivtv-driver.c b/drivers/media/pci/ivtv/ivtv-driver.c > index ecc20cd89926fe2ce4e472526a6b5fc0857615dd..7e2fb98cfccf02f701ceb4484dd1d330dd1dc867 100644 > --- a/drivers/media/pci/ivtv/ivtv-driver.c > +++ b/drivers/media/pci/ivtv/ivtv-driver.c > @@ -1260,15 +1260,12 @@ static int ivtv_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) > > int ivtv_init_on_first_open(struct ivtv *itv) > { > - struct v4l2_frequency vf; > /* Needed to call ioctls later */ > - struct ivtv_open_id fh; > + struct ivtv_stream *s = &itv->streams[IVTV_ENC_STREAM_TYPE_MPG]; > + struct v4l2_frequency vf; > int fw_retry_count = 3; > int video_input; > > - fh.itv = itv; > - fh.type = IVTV_ENC_STREAM_TYPE_MPG; > - > if (test_bit(IVTV_F_I_FAILED, &itv->i_flags)) > return -ENXIO; > > @@ -1310,13 +1307,13 @@ int ivtv_init_on_first_open(struct ivtv *itv) > > video_input = itv->active_input; > itv->active_input++; /* Force update of input */ > - ivtv_s_input(NULL, &fh, video_input); > + ivtv_do_s_input(itv, video_input); > > /* Let the VIDIOC_S_STD ioctl do all the work, keeps the code > in one place. */ > itv->std++; /* Force full standard initialization */ > itv->std_out = itv->std; > - ivtv_s_frequency(NULL, &fh, &vf); > + ivtv_do_s_frequency(s, &vf); > > if (itv->card->v4l2_capabilities & V4L2_CAP_VIDEO_OUTPUT) { > /* Turn on the TV-out: ivtv_init_mpeg_decoder() initializes > diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c b/drivers/media/pci/ivtv/ivtv-ioctl.c > index 8077a71d4850ec773caa20c3fca08f92f3117d69..dfbc842b22453868a2075935a81db7ae313ee46c 100644 > --- a/drivers/media/pci/ivtv/ivtv-ioctl.c > +++ b/drivers/media/pci/ivtv/ivtv-ioctl.c > @@ -974,9 +974,8 @@ static int ivtv_g_input(struct file *file, void *fh, unsigned int *i) > return 0; > } > > -int ivtv_s_input(struct file *file, void *fh, unsigned int inp) > +int ivtv_do_s_input(struct ivtv *itv, unsigned int inp) > { > - struct ivtv *itv = file2id(file)->itv; > v4l2_std_id std; > int i; > > @@ -1017,6 +1016,11 @@ int ivtv_s_input(struct file *file, void *fh, unsigned int inp) > return 0; > } > > +static int ivtv_s_input(struct file *file, void *fh, unsigned int inp) > +{ > + return ivtv_do_s_input(file2id(file)->itv, inp); > +} > + > static int ivtv_g_output(struct file *file, void *fh, unsigned int *i) > { > struct ivtv *itv = file2id(file)->itv; > @@ -1065,10 +1069,9 @@ static int ivtv_g_frequency(struct file *file, void *fh, struct v4l2_frequency * > return 0; > } > > -int ivtv_s_frequency(struct file *file, void *fh, const struct v4l2_frequency *vf) > +int ivtv_do_s_frequency(struct ivtv_stream *s, const struct v4l2_frequency *vf) > { > - struct ivtv *itv = file2id(file)->itv; > - struct ivtv_stream *s = &itv->streams[file2id(file)->type]; > + struct ivtv *itv = s->itv; > > if (s->vdev.vfl_dir) > return -ENOTTY; > @@ -1082,6 +1085,15 @@ int ivtv_s_frequency(struct file *file, void *fh, const struct v4l2_frequency *v > return 0; > } > > +static int ivtv_s_frequency(struct file *file, void *fh, > + const struct v4l2_frequency *vf) > +{ > + struct ivtv_open_id *id = file2id(file); > + struct ivtv *itv = id->itv; > + > + return ivtv_do_s_frequency(&itv->streams[id->type], vf); > +} > + > static int ivtv_g_std(struct file *file, void *fh, v4l2_std_id *std) > { > struct ivtv *itv = file2id(file)->itv; > diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.h b/drivers/media/pci/ivtv/ivtv-ioctl.h > index 42c2516379fcbbd0640820ab0e3abe9bf00b57ea..edc05eb8e060fd64d7ff94f8f7f5c315a2fa6298 100644 > --- a/drivers/media/pci/ivtv/ivtv-ioctl.h > +++ b/drivers/media/pci/ivtv/ivtv-ioctl.h > @@ -9,6 +9,8 @@ > #ifndef IVTV_IOCTL_H > #define IVTV_IOCTL_H > > +struct ivtv; > + > u16 ivtv_service2vbi(int type); > void ivtv_expand_service_set(struct v4l2_sliced_vbi_format *fmt, int is_pal); > u16 ivtv_get_service_set(struct v4l2_sliced_vbi_format *fmt); > @@ -17,7 +19,7 @@ int ivtv_set_speed(struct ivtv *itv, int speed); > void ivtv_set_funcs(struct video_device *vdev); > void ivtv_s_std_enc(struct ivtv *itv, v4l2_std_id std); > void ivtv_s_std_dec(struct ivtv *itv, v4l2_std_id std); > -int ivtv_s_frequency(struct file *file, void *fh, const struct v4l2_frequency *vf); > -int ivtv_s_input(struct file *file, void *fh, unsigned int inp); > +int ivtv_do_s_frequency(struct ivtv_stream *s, const struct v4l2_frequency *vf); > +int ivtv_do_s_input(struct ivtv *itv, unsigned int inp); > > #endif > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id SHvfIPE67mjSvQ8AYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 11:58:41 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 11:58:41 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8dft-00000004iVc-0qrj for hi@josie.lol; Tue, 14 Oct 2025 11:58:41 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E65673AA1A5 for ; Tue, 14 Oct 2025 11:57:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 938583081B9; Tue, 14 Oct 2025 11:57:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rKGG2qN/" X-Original-To: stable@vger.kernel.org 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 63BBD13D539; Tue, 14 Oct 2025 11:57:57 +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=1760443077; cv=none; b=GcKyMnp7WbJk0lg6vPorex0EPfX6j0j1yCDTBayVRuK4re/0xLJ9GCJ2xIzVNngA6YwdDuNtx8T0IgPzI4Y+YWh2N+LDldwVF2rTrrn2r+9YanMfntUi242CKhj5xDHJOPDsPzDcZAetKkgWKDZnq/nv47d5IjVmiqN7uxjQafE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760443077; c=relaxed/simple; bh=MwFsTXJugioHv41ijTZirhY8i4xRXoi7Y4vCJ56SHUY=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=t5A7gQ+pHrgXqbOoDNul3f7P73x2OLUcPRaCDg+jMNCfg5OmVylJxLFzCqyV3oPf7TJRLyvIikTYAELVIKCQYnOSwFnhDsdLKM77hhg2s9fCgtmP2Vt+e3mJKduS4b07OC90w5hgXvgHXKx+RTCX+1eao2gHNle9BfD4/Meyres= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rKGG2qN/; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F6C3C4CEE7; Tue, 14 Oct 2025 11:57:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760443076; bh=MwFsTXJugioHv41ijTZirhY8i4xRXoi7Y4vCJ56SHUY=; h=Date:From:Subject:To:Cc:References:In-Reply-To:From; b=rKGG2qN/DFIWc+QTzf8G73nx++OTjbQi7n/3Qb45wM2YdJxAiGXnjkeUWgOH7Bdse f9UynPWYm/RHkQbJdyl6I09Si1ScilHmRZ5KV+geOmmM34yL1QQHsYj8qiAvMVVzS2 w9D1YTIjOX6xW4LIA7w72cnh9IMPp3OaYkpXvFbTGicWcFpuyYzOiUk4wjaMwJwt6/ 7WKUGdwq6YE1qjiPOxzw6uHsuJFd7bnbg68vG1eoRdnAGwgk2kowUyy/9Dt2p+oiqa TC2XZHmvz9vyeukT4VaNcE1AKVyW+UNe1NPuVyvp86hiFyKwhLV9A7Jj9mgo5h/gWI qpRCvNpvsdWAg== Message-ID: <1efc306d-a786-4863-82c5-517f1d4f7899@kernel.org> Date: Tue, 14 Oct 2025 13:57:53 +0200 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Hans Verkuil Subject: Re: [PATCH v4 0/2] media: pci: Fix invalid access to file * To: Jacopo Mondi Cc: Andy Walls , Mauro Carvalho Chehab , Laurent Pinchart , Dan Carpenter , stable@vger.kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org References: <20250819-cx18-v4l2-fh-v4-0-9db1635d6787@ideasonboard.com> <0627cfba-798a-482b-b335-cc78a609c150@kernel.org> <3cqjf6pts5fzs5gziog3g3jay6txcvxshm554uqpzgb6ymnukh@dsbo27d47rol> Content-Language: en-US, nl In-Reply-To: <3cqjf6pts5fzs5gziog3g3jay6txcvxshm554uqpzgb6ymnukh@dsbo27d47rol> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.2 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.2 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -11 On 14/10/2025 13:52, Jacopo Mondi wrote: > Hi Hans > > On Tue, Oct 14, 2025 at 09:05:20AM +0200, Hans Verkuil wrote: >> Hi Jacopo, >> >> On 19/08/2025 09:07, Jacopo Mondi wrote: >>> Since commits >>> 7b9eb53e8591 ("media: cx18: Access v4l2_fh from file") >>> 9ba9d11544f9 ("media: ivtv: Access v4l2_fh from file") >>> >>> All the ioctl handlers access their private data structures >>> from file * >>> >>> The ivtv and cx18 drivers call the ioctl handlers from their >>> DVB layer without a valid file *, causing invalid memory access. >>> >>> The issue has been reported by smatch in >>> "[bug report] media: cx18: Access v4l2_fh from file" >>> >>> Fix this by providing wrappers for the ioctl handlers to be >>> used by the DVB layer that do not require a valid file *. >> >> This series should go to the fixes branch for v6.18, right? >> This looks like a pure regression, so I think that makes sense. >> > > I think so, yes > >> BTW, why is there a Link: tag in the cx18 patch? It just links to >> the v1 of the patch and that doesn't add meaningful information. >> Linus likes Link:, but only if it really adds useful information. > > Good question. I presume it's probably a copy&paste error, as it has no > place in the patch. > > Would you like me to resend or will you remove it ? I would prefer a resend for these two patches, clearly marked as [PATCH for v6.18 v5 n/2] in the subject. Normally I'd just drop the Link: tag, but it's good to have this clearly marked as a fix for v6.18. I'll also see if I can do a quick test of these two patches with my ivtv and cx18 boards. Just to make sure there are no other corner cases lurking in these drivers. Regards, Hans > > >> >> Regards, >> >> Hans >> >>> >>> Signed-off-by: Jacopo Mondi >>> --- >>> Changes in v4: >>> - Slightly adjust commit messages >>> - Link to v3: https://lore.kernel.org/r/20250818-cx18-v4l2-fh-v3-0-5e2f08f3cadc@ideasonboard.com >>> >>> Changes in v3: >>> - Change helpers to accept the type they're going to operate on instead >>> of using the open_id wrapper type as suggested by Laurent >>> - Link to v2: https://lore.kernel.org/r/20250818-cx18-v4l2-fh-v2-0-3f53ce423663@ideasonboard.com >>> >>> Changes in v2: >>> - Add Cc: stable@vger.kernel.org per-patch >>> >>> --- >>> Jacopo Mondi (2): >>> media: cx18: Fix invalid access to file * >>> media: ivtv: Fix invalid access to file * >>> >>> drivers/media/pci/cx18/cx18-driver.c | 9 +++------ >>> drivers/media/pci/cx18/cx18-ioctl.c | 30 +++++++++++++++++++----------- >>> drivers/media/pci/cx18/cx18-ioctl.h | 8 +++++--- >>> drivers/media/pci/ivtv/ivtv-driver.c | 11 ++++------- >>> drivers/media/pci/ivtv/ivtv-ioctl.c | 22 +++++++++++++++++----- >>> drivers/media/pci/ivtv/ivtv-ioctl.h | 6 ++++-- >>> 6 files changed, 52 insertions(+), 34 deletions(-) >>> --- >>> base-commit: a75b8d198c55e9eb5feb6f6e155496305caba2dc >>> change-id: 20250818-cx18-v4l2-fh-7eaa6199fdde >>> >>> Best regards, >> From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id QNEoJbM57mjSvQ8AYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 11:53:23 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 11:53:23 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8dal-00000004V80-1CZN for hi@josie.lol; Tue, 14 Oct 2025 11:53:23 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5C13254307F for ; Tue, 14 Oct 2025 11:52:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 979873101BB; Tue, 14 Oct 2025 11:52:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="p8gsXycd" X-Original-To: stable@vger.kernel.org Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 7A58F3101B6; Tue, 14 Oct 2025 11:52:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760442750; cv=none; b=JUO+dtNEvieH92L2l48EHNBbk5ntWpHEgmnGc+16rshof8n9OWcxNK2qsuJHcwj6QB6wAaHIjVY0X+rCSlnfB5HSzvVY4XAe+t3thP4yUQbViPRseZON9TbAi3OmFZ32CpkmUun4KuZPR/5y7eOJugn6DCA+M2tK4cd6GKaqL/Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760442750; c=relaxed/simple; bh=3XVJuLXTqcUwfWrdJ5RIn39dvkfVJ7NKAlswAxMmqtk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ch2KmE/X6/nz5ziSWq3IB5XfjNt30zwkOh53PVgSxuG6eje2mvz2S02Rfkm2/eKZNkeNRZFrLqCQeSdF/gdpEUYjZ6R5dn033unqJv4MdnTM86AMorFVWrO7SNQURqa7+4RFUYTZNwooJa+2ZM+n6M3peQPrato5jEKRY1/2j2E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=p8gsXycd; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Received: from ideasonboard.com (93-46-82-201.ip106.fastwebnet.it [93.46.82.201]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C22B3C7B; Tue, 14 Oct 2025 13:50:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1760442642; bh=3XVJuLXTqcUwfWrdJ5RIn39dvkfVJ7NKAlswAxMmqtk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=p8gsXycdcA3BtZ7uS5smhn0oU3DLtZaFu41WcGnW99Wf2sh46ZnM8v/1cWyjefm0E 7DeLaXAVKw+nIBtIsampBkDXrt5TYy6HQvxGaOgLQSQA/wiebRWih8jk3eNXGiPCiq 9h3kVgyIcYP7+XexV3f+SxWlu77qkZy+xYRHxZkQ= Date: Tue, 14 Oct 2025 13:52:18 +0200 From: Jacopo Mondi To: Hans Verkuil Cc: Jacopo Mondi , Andy Walls , Mauro Carvalho Chehab , Laurent Pinchart , Dan Carpenter , stable@vger.kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 0/2] media: pci: Fix invalid access to file * Message-ID: <3cqjf6pts5fzs5gziog3g3jay6txcvxshm554uqpzgb6ymnukh@dsbo27d47rol> References: <20250819-cx18-v4l2-fh-v4-0-9db1635d6787@ideasonboard.com> <0627cfba-798a-482b-b335-cc78a609c150@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <0627cfba-798a-482b-b335-cc78a609c150@kernel.org> X-DKIM: signer='ideasonboard.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 Hi Hans On Tue, Oct 14, 2025 at 09:05:20AM +0200, Hans Verkuil wrote: > Hi Jacopo, > > On 19/08/2025 09:07, Jacopo Mondi wrote: > > Since commits > > 7b9eb53e8591 ("media: cx18: Access v4l2_fh from file") > > 9ba9d11544f9 ("media: ivtv: Access v4l2_fh from file") > > > > All the ioctl handlers access their private data structures > > from file * > > > > The ivtv and cx18 drivers call the ioctl handlers from their > > DVB layer without a valid file *, causing invalid memory access. > > > > The issue has been reported by smatch in > > "[bug report] media: cx18: Access v4l2_fh from file" > > > > Fix this by providing wrappers for the ioctl handlers to be > > used by the DVB layer that do not require a valid file *. > > This series should go to the fixes branch for v6.18, right? > This looks like a pure regression, so I think that makes sense. > I think so, yes > BTW, why is there a Link: tag in the cx18 patch? It just links to > the v1 of the patch and that doesn't add meaningful information. > Linus likes Link:, but only if it really adds useful information. Good question. I presume it's probably a copy&paste error, as it has no place in the patch. Would you like me to resend or will you remove it ? > > Regards, > > Hans > > > > > Signed-off-by: Jacopo Mondi > > --- > > Changes in v4: > > - Slightly adjust commit messages > > - Link to v3: https://lore.kernel.org/r/20250818-cx18-v4l2-fh-v3-0-5e2f08f3cadc@ideasonboard.com > > > > Changes in v3: > > - Change helpers to accept the type they're going to operate on instead > > of using the open_id wrapper type as suggested by Laurent > > - Link to v2: https://lore.kernel.org/r/20250818-cx18-v4l2-fh-v2-0-3f53ce423663@ideasonboard.com > > > > Changes in v2: > > - Add Cc: stable@vger.kernel.org per-patch > > > > --- > > Jacopo Mondi (2): > > media: cx18: Fix invalid access to file * > > media: ivtv: Fix invalid access to file * > > > > drivers/media/pci/cx18/cx18-driver.c | 9 +++------ > > drivers/media/pci/cx18/cx18-ioctl.c | 30 +++++++++++++++++++----------- > > drivers/media/pci/cx18/cx18-ioctl.h | 8 +++++--- > > drivers/media/pci/ivtv/ivtv-driver.c | 11 ++++------- > > drivers/media/pci/ivtv/ivtv-ioctl.c | 22 +++++++++++++++++----- > > drivers/media/pci/ivtv/ivtv-ioctl.h | 6 ++++-- > > 6 files changed, 52 insertions(+), 34 deletions(-) > > --- > > base-commit: a75b8d198c55e9eb5feb6f6e155496305caba2dc > > change-id: 20250818-cx18-v4l2-fh-7eaa6199fdde > > > > Best regards, > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id +AcYODr27WiMmykAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 07:05:30 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 07:05:30 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8Z6A-0000000CSxd-2psC for hi@josie.lol; Tue, 14 Oct 2025 07:05:30 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 9833C4F1920 for ; Tue, 14 Oct 2025 07:05:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DCBC42D3733; Tue, 14 Oct 2025 07:05:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qbbr7azH" X-Original-To: stable@vger.kernel.org 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 AD2EC16DC28; Tue, 14 Oct 2025 07:05:24 +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=1760425524; cv=none; b=Jcxn+ldC2N7QWebS+CdMkwpnU3Qx1ekaq0xIpvKKJtjg0JwX/8svx+nmSsupNh5OB2KXLAjThJfB6ZKPmhy4bOPPeuuGi445LGG9D1POp72gC4RHiFxleREGw82VVO9UFNEZA1T9jUvnZ+QKlTtDEKEEgKrl1neRik6mq/1NfZA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760425524; c=relaxed/simple; bh=jmNYVYVmbqAvjpNOVm8qG23vIn+BKX3VYzDscLcHBdw=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=u40VRAXdpYFlNoabldHrr2aCJmnVer+cVL9rQXotqjGYtPZlMbEtZklFXXsVGbJZbRzNaQQHW+uNaxliUftQ5cih+VfNC+OMIX3LUrNdUgizEsDoU0h+Ijf7R9Sva+hpcEqF+Vq2ZMhnhXAxqUuf+Q4BDnQXMZ/vcaWfbTnodt0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qbbr7azH; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81AAEC4CEE7; Tue, 14 Oct 2025 07:05:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760425524; bh=jmNYVYVmbqAvjpNOVm8qG23vIn+BKX3VYzDscLcHBdw=; h=Date:From:Subject:To:Cc:References:In-Reply-To:From; b=qbbr7azH0sXjxxiOaqIfASh67I5jmxfVCE0NjElmdi5DohLKT5JO7F3zkb4eCCxNP 8lc7v8SSWmknN0CI+oO7Bk1cOFNpq0FOPUu7xi2RzNIKrT4gBMpmx0GyBWaam/WESM 4SAn8xo2qObtDCWe1tZXBM63lDxoXCghYNw/oImqW/0GVOIXuKiylnI72vgk8EbA0S 6pjXRSBb10A2xiPHMoZslBBF+hk5x1iFN+pan47rEsGmsE5Ackzdtx1AStsBDiHIff ex33nOvlSLHuVlvENJp8FkE0AvG6LQsY9s9j8vdN9FF6RZ0I4Tj2efztc3Hb7W0IeJ Cwhh5F9p8GVCg== Message-ID: <0627cfba-798a-482b-b335-cc78a609c150@kernel.org> Date: Tue, 14 Oct 2025 09:05:20 +0200 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Hans Verkuil Subject: Re: [PATCH v4 0/2] media: pci: Fix invalid access to file * To: Jacopo Mondi , Andy Walls , Mauro Carvalho Chehab , Laurent Pinchart Cc: Dan Carpenter , stable@vger.kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org References: <20250819-cx18-v4l2-fh-v4-0-9db1635d6787@ideasonboard.com> Content-Language: en-US, nl In-Reply-To: <20250819-cx18-v4l2-fh-v4-0-9db1635d6787@ideasonboard.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.2 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.2 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -11 Hi Jacopo, On 19/08/2025 09:07, Jacopo Mondi wrote: > Since commits > 7b9eb53e8591 ("media: cx18: Access v4l2_fh from file") > 9ba9d11544f9 ("media: ivtv: Access v4l2_fh from file") > > All the ioctl handlers access their private data structures > from file * > > The ivtv and cx18 drivers call the ioctl handlers from their > DVB layer without a valid file *, causing invalid memory access. > > The issue has been reported by smatch in > "[bug report] media: cx18: Access v4l2_fh from file" > > Fix this by providing wrappers for the ioctl handlers to be > used by the DVB layer that do not require a valid file *. This series should go to the fixes branch for v6.18, right? This looks like a pure regression, so I think that makes sense. BTW, why is there a Link: tag in the cx18 patch? It just links to the v1 of the patch and that doesn't add meaningful information. Linus likes Link:, but only if it really adds useful information. Regards, Hans > > Signed-off-by: Jacopo Mondi > --- > Changes in v4: > - Slightly adjust commit messages > - Link to v3: https://lore.kernel.org/r/20250818-cx18-v4l2-fh-v3-0-5e2f08f3cadc@ideasonboard.com > > Changes in v3: > - Change helpers to accept the type they're going to operate on instead > of using the open_id wrapper type as suggested by Laurent > - Link to v2: https://lore.kernel.org/r/20250818-cx18-v4l2-fh-v2-0-3f53ce423663@ideasonboard.com > > Changes in v2: > - Add Cc: stable@vger.kernel.org per-patch > > --- > Jacopo Mondi (2): > media: cx18: Fix invalid access to file * > media: ivtv: Fix invalid access to file * > > drivers/media/pci/cx18/cx18-driver.c | 9 +++------ > drivers/media/pci/cx18/cx18-ioctl.c | 30 +++++++++++++++++++----------- > drivers/media/pci/cx18/cx18-ioctl.h | 8 +++++--- > drivers/media/pci/ivtv/ivtv-driver.c | 11 ++++------- > drivers/media/pci/ivtv/ivtv-ioctl.c | 22 +++++++++++++++++----- > drivers/media/pci/ivtv/ivtv-ioctl.h | 6 ++++-- > 6 files changed, 52 insertions(+), 34 deletions(-) > --- > base-commit: a75b8d198c55e9eb5feb6f6e155496305caba2dc > change-id: 20250818-cx18-v4l2-fh-7eaa6199fdde > > Best regards, From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id ML3KBn9J7mjY0BIAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 13:00:47 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 13:00:47 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8edy-00000006pwy-11HX for hi@josie.lol; Tue, 14 Oct 2025 13:00:47 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 94B1A3A1D51 for ; Tue, 14 Oct 2025 13:00:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D2FA91F17E8; Tue, 14 Oct 2025 13:00:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VvptaeDj" X-Original-To: stable@vger.kernel.org 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 AD50EDF49 for ; Tue, 14 Oct 2025 13:00:28 +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=1760446828; cv=none; b=TomLWUxnnqP4JTfw9B7TeZvNXHecH7K0blhvz2O666pI157m8D/I9sVMe9smEpmhds92iLR4CHIA30TjvuGtdOKUbhZiiaYLVsRPvtY8C/7nzjyHeEVR5ja59TqXJe3RDEmVOR18vGSm/cHDAV3dPqqwJq8f5qOcrJgejeOSHLI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760446828; c=relaxed/simple; bh=KyRyzVg30jXMn6bZNZ0rygSJ+SR+6mcaF+QaAS4lfxM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cRX1CI6VWF2dgUMTnNSWw48QMxAJZAjKEV5mVbzyFPjBFZOyknxCOTc7y/WdB4qwZTHQvlSyBDEPGatO7Ni1Su1wrvjaG8hubEFwZP4tEUG99t9dzKhcPrZynXfUDWiOhZNr55vaN/22ZZx6+a8Q0Rm7hMxUxrKVfIrWoHZYGLY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VvptaeDj; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2528C4CEE7; Tue, 14 Oct 2025 13:00:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760446828; bh=KyRyzVg30jXMn6bZNZ0rygSJ+SR+6mcaF+QaAS4lfxM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VvptaeDjxPREqhjaa16yrB2IiPS5mG1N7T4DlUBZwtuyTO3HQHjbpujwtyfC6PiqM Pp8Nr31evWZ35MykvcVjZmJt90LJX5TlwStWmvkR4HbV3iHqw7oqCCmFV7yQK+BWN+ ELZ8zLAnHofWQrIimme0I5bfEdtRCGN7jjAsGkPGozwxwR4ekYH3lqlba+yFpB8Lop QoINkkJLF1f9jHNzaE/LMBmVNCnawb9Rxk/CcP3eKnM4OJPUY+sphk2jCEqiUhxvbR 9sU4N8aRRoFY8PUzMCD/yu6fovHWxtU6v/B6eybmKoSm53qfpUn5MaqEMGU6aZd0OY 7JsicIBD7gzjA== From: Sasha Levin To: stable@vger.kernel.org Cc: Yuan Chen , "Masami Hiramatsu (Google)" , Sasha Levin Subject: [PATCH 5.4.y] tracing: Fix race condition in kprobe initialization causing NULL pointer dereference Date: Tue, 14 Oct 2025 09:00:26 -0400 Message-ID: <20251014130026.12319-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2025101331-mulled-pueblo-7ac2@gregkh> References: <2025101331-mulled-pueblo-7ac2@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -3.5 (---) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-3.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [139.178.88.99 listed in list.dnswl.org] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -34 From: Yuan Chen [ Upstream commit 9cf9aa7b0acfde7545c1a1d912576e9bab28dc6f ] There is a critical race condition in kprobe initialization that can lead to NULL pointer dereference and kernel crash. [1135630.084782] Unable to handle kernel paging request at virtual address 0000710a04630000 ... [1135630.260314] pstate: 404003c9 (nZcv DAIF +PAN -UAO) [1135630.269239] pc : kprobe_perf_func+0x30/0x260 [1135630.277643] lr : kprobe_dispatcher+0x44/0x60 [1135630.286041] sp : ffffaeff4977fa40 [1135630.293441] x29: ffffaeff4977fa40 x28: ffffaf015340e400 [1135630.302837] x27: 0000000000000000 x26: 0000000000000000 [1135630.312257] x25: ffffaf029ed108a8 x24: ffffaf015340e528 [1135630.321705] x23: ffffaeff4977fc50 x22: ffffaeff4977fc50 [1135630.331154] x21: 0000000000000000 x20: ffffaeff4977fc50 [1135630.340586] x19: ffffaf015340e400 x18: 0000000000000000 [1135630.349985] x17: 0000000000000000 x16: 0000000000000000 [1135630.359285] x15: 0000000000000000 x14: 0000000000000000 [1135630.368445] x13: 0000000000000000 x12: 0000000000000000 [1135630.377473] x11: 0000000000000000 x10: 0000000000000000 [1135630.386411] x9 : 0000000000000000 x8 : 0000000000000000 [1135630.395252] x7 : 0000000000000000 x6 : 0000000000000000 [1135630.403963] x5 : 0000000000000000 x4 : 0000000000000000 [1135630.412545] x3 : 0000710a04630000 x2 : 0000000000000006 [1135630.421021] x1 : ffffaeff4977fc50 x0 : 0000710a04630000 [1135630.429410] Call trace: [1135630.434828] kprobe_perf_func+0x30/0x260 [1135630.441661] kprobe_dispatcher+0x44/0x60 [1135630.448396] aggr_pre_handler+0x70/0xc8 [1135630.454959] kprobe_breakpoint_handler+0x140/0x1e0 [1135630.462435] brk_handler+0xbc/0xd8 [1135630.468437] do_debug_exception+0x84/0x138 [1135630.475074] el1_dbg+0x18/0x8c [1135630.480582] security_file_permission+0x0/0xd0 [1135630.487426] vfs_write+0x70/0x1c0 [1135630.493059] ksys_write+0x5c/0xc8 [1135630.498638] __arm64_sys_write+0x24/0x30 [1135630.504821] el0_svc_common+0x78/0x130 [1135630.510838] el0_svc_handler+0x38/0x78 [1135630.516834] el0_svc+0x8/0x1b0 kernel/trace/trace_kprobe.c: 1308 0xffff3df8995039ec : ldr x21, [x24,#120] include/linux/compiler.h: 294 0xffff3df8995039f0 : ldr x1, [x21,x0] kernel/trace/trace_kprobe.c 1308: head = this_cpu_ptr(call->perf_events); 1309: if (hlist_empty(head)) 1310: return 0; crash> struct trace_event_call -o struct trace_event_call { ... [120] struct hlist_head *perf_events; //(call->perf_event) ... } crash> struct trace_event_call ffffaf015340e528 struct trace_event_call { ... perf_events = 0xffff0ad5fa89f088, //this value is correct, but x21 = 0 ... } Race Condition Analysis: The race occurs between kprobe activation and perf_events initialization: CPU0 CPU1 ==== ==== perf_kprobe_init perf_trace_event_init tp_event->perf_events = list;(1) tp_event->class->reg (2)← KPROBE ACTIVE Debug exception triggers ... kprobe_dispatcher kprobe_perf_func (tk->tp.flags & TP_FLAG_PROFILE) head = this_cpu_ptr(call->perf_events)(3) (perf_events is still NULL) Problem: 1. CPU0 executes (1) assigning tp_event->perf_events = list 2. CPU0 executes (2) enabling kprobe functionality via class->reg() 3. CPU1 triggers and reaches kprobe_dispatcher 4. CPU1 checks TP_FLAG_PROFILE - condition passes (step 2 completed) 5. CPU1 calls kprobe_perf_func() and crashes at (3) because call->perf_events is still NULL CPU1 sees that kprobe functionality is enabled but does not see that perf_events has been assigned. Add pairing read and write memory barriers to guarantee that if CPU1 sees that kprobe functionality is enabled, it must also see that perf_events has been assigned. Link: https://lore.kernel.org/all/20251001022025.44626-1-chenyuan_fl@163.com/ Fixes: 50d780560785 ("tracing/kprobes: Add probe handler dispatcher to support perf and ftrace concurrent use") Cc: stable@vger.kernel.org Signed-off-by: Yuan Chen Signed-off-by: Masami Hiramatsu (Google) [ Dropped ftrace changes + context ] Signed-off-by: Sasha Levin --- kernel/trace/trace_kprobe.c | 11 +++++++---- kernel/trace/trace_probe.h | 9 +++++++-- kernel/trace/trace_uprobe.c | 12 ++++++++---- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index 56d22752a52e3..01a9fc7279c6c 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -1585,14 +1585,15 @@ static int kprobe_register(struct trace_event_call *event, static int kprobe_dispatcher(struct kprobe *kp, struct pt_regs *regs) { struct trace_kprobe *tk = container_of(kp, struct trace_kprobe, rp.kp); + unsigned int flags = trace_probe_load_flag(&tk->tp); int ret = 0; raw_cpu_inc(*tk->nhit); - if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) kprobe_trace_func(tk, regs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret = kprobe_perf_func(tk, regs); #endif return ret; @@ -1603,13 +1604,15 @@ static int kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) { struct trace_kprobe *tk = container_of(ri->rp, struct trace_kprobe, rp); + unsigned int flags; raw_cpu_inc(*tk->nhit); - if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tk->tp); + if (flags & TP_FLAG_TRACE) kretprobe_trace_func(tk, ri, regs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) kretprobe_perf_func(tk, ri, regs); #endif return 0; /* We don't tweek kernel, so just return 0 */ diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h index edbb1624061ed..15c9ef34a611e 100644 --- a/kernel/trace/trace_probe.h +++ b/kernel/trace/trace_probe.h @@ -252,16 +252,21 @@ struct event_file_link { struct list_head list; }; +static inline unsigned int trace_probe_load_flag(struct trace_probe *tp) +{ + return smp_load_acquire(&tp->event->flags); +} + static inline bool trace_probe_test_flag(struct trace_probe *tp, unsigned int flag) { - return !!(tp->event->flags & flag); + return !!(trace_probe_load_flag(tp) & flag); } static inline void trace_probe_set_flag(struct trace_probe *tp, unsigned int flag) { - tp->event->flags |= flag; + smp_store_release(&tp->event->flags, tp->event->flags | flag); } static inline void trace_probe_clear_flag(struct trace_probe *tp, diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index e924c04af627e..4f844df6ee000 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c @@ -1465,6 +1465,7 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs) struct uprobe_dispatch_data udd; struct uprobe_cpu_buffer *ucb; int dsize, esize; + unsigned int flags; int ret = 0; @@ -1485,11 +1486,12 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs) ucb = uprobe_buffer_get(); store_trace_args(ucb->buf, &tu->tp, regs, esize, dsize); - if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tu->tp); + if (flags & TP_FLAG_TRACE) ret |= uprobe_trace_func(tu, regs, ucb, dsize); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret |= uprobe_perf_func(tu, regs, ucb, dsize); #endif uprobe_buffer_put(ucb); @@ -1503,6 +1505,7 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, struct uprobe_dispatch_data udd; struct uprobe_cpu_buffer *ucb; int dsize, esize; + unsigned int flags; tu = container_of(con, struct trace_uprobe, consumer); @@ -1520,11 +1523,12 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, ucb = uprobe_buffer_get(); store_trace_args(ucb->buf, &tu->tp, regs, esize, dsize); - if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tu->tp); + if (flags & TP_FLAG_TRACE) uretprobe_trace_func(tu, func, regs, ucb, dsize); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) uretprobe_perf_func(tu, func, regs, ucb, dsize); #endif uprobe_buffer_put(ucb); -- 2.51.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id GE2OL9C37Gh15gUAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 08:26:56 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 08:26:56 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8DtQ-0000000230B-0smS for hi@josie.lol; Mon, 13 Oct 2025 08:26:56 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 36CE13C15BD for ; Mon, 13 Oct 2025 08:26:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BEB932F5324; Mon, 13 Oct 2025 08:26:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="XM3Xw5NI" X-Original-To: stable@vger.kernel.org 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 99EC92F4A19 for ; Mon, 13 Oct 2025 08:26:37 +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=1760343997; cv=none; b=kaxTLf6a31TGvpG/BUFHR5eYW8aRIYHm+CEpF11aA6VVHcPb61E+tm0BPD98ktAxEvvRBXpVOOPiRRvyjjOSQNkjunDmNk4wU1OD8gJN8Xyazu5NOkS0vo/wwwDFKaNEtAxZt9ldyYGMNSxClimW6BoA3hEOZNG83Y3TVAXvs2I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760343997; c=relaxed/simple; bh=U+NGPbW9QT4UfbuRiC5a1b4TyheBPlHmqPCzEu8ERG0=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=ckYUWcKT+nCnYRX1Frr7k0UYWsUOb+XyUGkl/JVSClqEeAa6LuFonM63EGMAAsvg+Q2Nijb19BX994suwyvae0uqFKKOgcFY3GnrVBTnVdxHhmO7eUD7p2faOI6UqD4Tcax2x/HvxzIf1RtjrBes/5yJkGPPW8zPLIIKNvkfRck= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=XM3Xw5NI; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5CF9C4CEFE; Mon, 13 Oct 2025 08:26:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760343997; bh=U+NGPbW9QT4UfbuRiC5a1b4TyheBPlHmqPCzEu8ERG0=; h=Subject:To:Cc:From:Date:From; b=XM3Xw5NIY2wX1LiZN36RZayXSDStA+6el2pJtp0FWaHWkgfHVaGAnw3fGO6SQkW/F I7GkhD50lRfxChun04EVrxkI0w3dAO9jq5GhgspvxRz7jRmU9r69P2aPM8buVSQ0fa w+vt5kx74JZDL7cmkuAJOTJ4ZAOtp0R1a9Y3ZDxI= Subject: FAILED: patch "[PATCH] tracing: Fix race condition in kprobe initialization causing" failed to apply to 5.4-stable tree To: chenyuan@kylinos.cn,mhiramat@kernel.org Cc: From: Date: Mon, 13 Oct 2025 10:26:31 +0200 Message-ID: <2025101331-mulled-pueblo-7ac2@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-DKIM: signer='linuxfoundation.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linuxfoundation.org] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -18 The patch below does not apply to the 5.4-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.4.y git checkout FETCH_HEAD git cherry-pick -x 9cf9aa7b0acfde7545c1a1d912576e9bab28dc6f # git commit -s git send-email --to '' --in-reply-to '2025101331-mulled-pueblo-7ac2@gregkh' --subject-prefix 'PATCH 5.4.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 9cf9aa7b0acfde7545c1a1d912576e9bab28dc6f Mon Sep 17 00:00:00 2001 From: Yuan Chen Date: Wed, 1 Oct 2025 03:20:25 +0100 Subject: [PATCH] tracing: Fix race condition in kprobe initialization causing NULL pointer dereference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is a critical race condition in kprobe initialization that can lead to NULL pointer dereference and kernel crash. [1135630.084782] Unable to handle kernel paging request at virtual address 0000710a04630000 ... [1135630.260314] pstate: 404003c9 (nZcv DAIF +PAN -UAO) [1135630.269239] pc : kprobe_perf_func+0x30/0x260 [1135630.277643] lr : kprobe_dispatcher+0x44/0x60 [1135630.286041] sp : ffffaeff4977fa40 [1135630.293441] x29: ffffaeff4977fa40 x28: ffffaf015340e400 [1135630.302837] x27: 0000000000000000 x26: 0000000000000000 [1135630.312257] x25: ffffaf029ed108a8 x24: ffffaf015340e528 [1135630.321705] x23: ffffaeff4977fc50 x22: ffffaeff4977fc50 [1135630.331154] x21: 0000000000000000 x20: ffffaeff4977fc50 [1135630.340586] x19: ffffaf015340e400 x18: 0000000000000000 [1135630.349985] x17: 0000000000000000 x16: 0000000000000000 [1135630.359285] x15: 0000000000000000 x14: 0000000000000000 [1135630.368445] x13: 0000000000000000 x12: 0000000000000000 [1135630.377473] x11: 0000000000000000 x10: 0000000000000000 [1135630.386411] x9 : 0000000000000000 x8 : 0000000000000000 [1135630.395252] x7 : 0000000000000000 x6 : 0000000000000000 [1135630.403963] x5 : 0000000000000000 x4 : 0000000000000000 [1135630.412545] x3 : 0000710a04630000 x2 : 0000000000000006 [1135630.421021] x1 : ffffaeff4977fc50 x0 : 0000710a04630000 [1135630.429410] Call trace: [1135630.434828] kprobe_perf_func+0x30/0x260 [1135630.441661] kprobe_dispatcher+0x44/0x60 [1135630.448396] aggr_pre_handler+0x70/0xc8 [1135630.454959] kprobe_breakpoint_handler+0x140/0x1e0 [1135630.462435] brk_handler+0xbc/0xd8 [1135630.468437] do_debug_exception+0x84/0x138 [1135630.475074] el1_dbg+0x18/0x8c [1135630.480582] security_file_permission+0x0/0xd0 [1135630.487426] vfs_write+0x70/0x1c0 [1135630.493059] ksys_write+0x5c/0xc8 [1135630.498638] __arm64_sys_write+0x24/0x30 [1135630.504821] el0_svc_common+0x78/0x130 [1135630.510838] el0_svc_handler+0x38/0x78 [1135630.516834] el0_svc+0x8/0x1b0 kernel/trace/trace_kprobe.c: 1308 0xffff3df8995039ec : ldr x21, [x24,#120] include/linux/compiler.h: 294 0xffff3df8995039f0 : ldr x1, [x21,x0] kernel/trace/trace_kprobe.c 1308: head = this_cpu_ptr(call->perf_events); 1309: if (hlist_empty(head)) 1310: return 0; crash> struct trace_event_call -o struct trace_event_call { ... [120] struct hlist_head *perf_events; //(call->perf_event) ... } crash> struct trace_event_call ffffaf015340e528 struct trace_event_call { ... perf_events = 0xffff0ad5fa89f088, //this value is correct, but x21 = 0 ... } Race Condition Analysis: The race occurs between kprobe activation and perf_events initialization: CPU0 CPU1 ==== ==== perf_kprobe_init perf_trace_event_init tp_event->perf_events = list;(1) tp_event->class->reg (2)← KPROBE ACTIVE Debug exception triggers ... kprobe_dispatcher kprobe_perf_func (tk->tp.flags & TP_FLAG_PROFILE) head = this_cpu_ptr(call->perf_events)(3) (perf_events is still NULL) Problem: 1. CPU0 executes (1) assigning tp_event->perf_events = list 2. CPU0 executes (2) enabling kprobe functionality via class->reg() 3. CPU1 triggers and reaches kprobe_dispatcher 4. CPU1 checks TP_FLAG_PROFILE - condition passes (step 2 completed) 5. CPU1 calls kprobe_perf_func() and crashes at (3) because call->perf_events is still NULL CPU1 sees that kprobe functionality is enabled but does not see that perf_events has been assigned. Add pairing read and write memory barriers to guarantee that if CPU1 sees that kprobe functionality is enabled, it must also see that perf_events has been assigned. Link: https://lore.kernel.org/all/20251001022025.44626-1-chenyuan_fl@163.com/ Fixes: 50d780560785 ("tracing/kprobes: Add probe handler dispatcher to support perf and ftrace concurrent use") Cc: stable@vger.kernel.org Signed-off-by: Yuan Chen Signed-off-by: Masami Hiramatsu (Google) diff --git a/kernel/trace/trace_fprobe.c b/kernel/trace/trace_fprobe.c index b36ade43d4b3..ad9d6347b5fa 100644 --- a/kernel/trace/trace_fprobe.c +++ b/kernel/trace/trace_fprobe.c @@ -522,13 +522,14 @@ static int fentry_dispatcher(struct fprobe *fp, unsigned long entry_ip, void *entry_data) { struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp); + unsigned int flags = trace_probe_load_flag(&tf->tp); int ret = 0; - if (trace_probe_test_flag(&tf->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) fentry_trace_func(tf, entry_ip, fregs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tf->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret = fentry_perf_func(tf, entry_ip, fregs); #endif return ret; @@ -540,11 +541,12 @@ static void fexit_dispatcher(struct fprobe *fp, unsigned long entry_ip, void *entry_data) { struct trace_fprobe *tf = container_of(fp, struct trace_fprobe, fp); + unsigned int flags = trace_probe_load_flag(&tf->tp); - if (trace_probe_test_flag(&tf->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) fexit_trace_func(tf, entry_ip, ret_ip, fregs, entry_data); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tf->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) fexit_perf_func(tf, entry_ip, ret_ip, fregs, entry_data); #endif } diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index fa60362a3f31..ee8171b19bee 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -1815,14 +1815,15 @@ static int kprobe_register(struct trace_event_call *event, static int kprobe_dispatcher(struct kprobe *kp, struct pt_regs *regs) { struct trace_kprobe *tk = container_of(kp, struct trace_kprobe, rp.kp); + unsigned int flags = trace_probe_load_flag(&tk->tp); int ret = 0; raw_cpu_inc(*tk->nhit); - if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) + if (flags & TP_FLAG_TRACE) kprobe_trace_func(tk, regs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret = kprobe_perf_func(tk, regs); #endif return ret; @@ -1834,6 +1835,7 @@ kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) { struct kretprobe *rp = get_kretprobe(ri); struct trace_kprobe *tk; + unsigned int flags; /* * There is a small chance that get_kretprobe(ri) returns NULL when @@ -1846,10 +1848,11 @@ kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) tk = container_of(rp, struct trace_kprobe, rp); raw_cpu_inc(*tk->nhit); - if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tk->tp); + if (flags & TP_FLAG_TRACE) kretprobe_trace_func(tk, ri, regs); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) kretprobe_perf_func(tk, ri, regs); #endif return 0; /* We don't tweak kernel, so just return 0 */ diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h index 842383fbc03b..08b5bda24da2 100644 --- a/kernel/trace/trace_probe.h +++ b/kernel/trace/trace_probe.h @@ -271,16 +271,21 @@ struct event_file_link { struct list_head list; }; +static inline unsigned int trace_probe_load_flag(struct trace_probe *tp) +{ + return smp_load_acquire(&tp->event->flags); +} + static inline bool trace_probe_test_flag(struct trace_probe *tp, unsigned int flag) { - return !!(tp->event->flags & flag); + return !!(trace_probe_load_flag(tp) & flag); } static inline void trace_probe_set_flag(struct trace_probe *tp, unsigned int flag) { - tp->event->flags |= flag; + smp_store_release(&tp->event->flags, tp->event->flags | flag); } static inline void trace_probe_clear_flag(struct trace_probe *tp, diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index 8b0bcc0d8f41..430d09c49462 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c @@ -1547,6 +1547,7 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs, struct trace_uprobe *tu; struct uprobe_dispatch_data udd; struct uprobe_cpu_buffer *ucb = NULL; + unsigned int flags; int ret = 0; tu = container_of(con, struct trace_uprobe, consumer); @@ -1561,11 +1562,12 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs, if (WARN_ON_ONCE(!uprobe_cpu_buffer)) return 0; - if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tu->tp); + if (flags & TP_FLAG_TRACE) ret |= uprobe_trace_func(tu, regs, &ucb); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) ret |= uprobe_perf_func(tu, regs, &ucb); #endif uprobe_buffer_put(ucb); @@ -1579,6 +1581,7 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, struct trace_uprobe *tu; struct uprobe_dispatch_data udd; struct uprobe_cpu_buffer *ucb = NULL; + unsigned int flags; tu = container_of(con, struct trace_uprobe, consumer); @@ -1590,11 +1593,12 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, if (WARN_ON_ONCE(!uprobe_cpu_buffer)) return 0; - if (trace_probe_test_flag(&tu->tp, TP_FLAG_TRACE)) + flags = trace_probe_load_flag(&tu->tp); + if (flags & TP_FLAG_TRACE) uretprobe_trace_func(tu, func, regs, &ucb); #ifdef CONFIG_PERF_EVENTS - if (trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE)) + if (flags & TP_FLAG_PROFILE) uretprobe_perf_func(tu, func, regs, &ucb); #endif uprobe_buffer_put(ucb); From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id WJAqFZJK7mhXdxYAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 13:05:22 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 13:05:22 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8eiQ-000000071Bm-0JHg for hi@josie.lol; Tue, 14 Oct 2025 13:05:22 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5FD83580186 for ; Tue, 14 Oct 2025 13:02:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A7C8D1DED5C; Tue, 14 Oct 2025 13:01:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X5WuHwNM" X-Original-To: io-uring@vger.kernel.org Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E2938DF49 for ; Tue, 14 Oct 2025 13:01:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760446916; cv=none; b=ANkMiakTAyvmbPXesHhSRZjKs/47E7gYne8tw6LwHaNdjOkaaAuMxjXghkyUBqELKUY4aPUMNQIR9bZ8L0vOi9L0X4JytPjf63FZvgrSVYdQSuSIHAkNSDkoCU8le3kCoSGeY92IcFDI2nXJPF5Wa0UiCYGpHXldt8bFoF1a2VE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760446916; c=relaxed/simple; bh=2PZ7Dxiux29sn2cxLLbfjy5baL0JUF5GxdCqMf2A7vA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hwLhtBBrF0eEGmsFllA1cU1m5xnJX0KZJHXYDXvOT7jkWlwMTpAE91KqOuozD/VbuEWj6OVYawyjzAEjUlRmEsm16pdO1+mCwAYU+TZOZZRQCJH66hbDCRVDnja7fHdd43uR5/2N5izbSfHXnEk1YGBmmibaUfd0xa/Qiz+C0YU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=X5WuHwNM; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-3ee1221ceaaso4331036f8f.3 for ; Tue, 14 Oct 2025 06:01:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760446913; x=1761051713; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Orem4t6QfSI5JFiug2h5DjVy4ER1OmliqxRluIkKeWg=; b=X5WuHwNM3pxJoKh2q75+gfboP50bMXVfYAczv0kox+2KJ8OpzfKOq8AVucrnCXVnLv Az92vUSAhz0QjQGDyuFb3UdnmhKP74BEwSQOasnxOMlu7gY8hsoPo9avdafBoshXokDh woRq7tMdufnWEmYVhmXbNbudYkrFC+khWf6GC8vzhbgWCcNs3iEjQ6beMEAnbMyC3myU s08+94Dr+GwbPdoF1ImXT1KXGZ+1fBuqgCsHLzU0DL2TWUJV8tNahrf2xP3t0D+HOzxz HpFH6QCOLS42ek8ah0KeZEJNCYbIuSfxaSpW6g1cwwaVyf01IA3QvJphpwMz9dd30y1R NmdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760446913; x=1761051713; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Orem4t6QfSI5JFiug2h5DjVy4ER1OmliqxRluIkKeWg=; b=QnAg8gzk8dQWYw6p/N3dtwgNvzEUjH5P/8+aFT6cjypZI1BXJUjQprg0Tyc/cKmS6t ineUs4uYqbCC6fGn7ElLHiINRuu6VanvEOZrfWR4KmjaEslYDH9Y2SyY62uJSSQvrg3+ O+JL30pkKv9hQFzvKfyWk4Jk4/aNlmrdbIXZfGY+SGg47M0L9MBNP7aQaOkVnM8r/RBL 9D2dkFWyEuYGizUF+IDdfcfwyXao7dK42q2MjN7tOqxiwCpsf0lQLS4FvXwyPtXwWNuk 3Rjz7ShtxeKHyTw4CdKPgg2WfzPLBBo/j4K6Kt262vTJSxWqkc9tb6bnGA/jP7h6wnch gxQg== X-Forwarded-Encrypted: i=1; AJvYcCUx21X/gPlC1JFWe/ig2zuu8QKA86iaW5DOJ6HVUytVipz09eE2JBJuhvEiMWXSZqIv92Abd+95Yg==@vger.kernel.org X-Gm-Message-State: AOJu0YxDyUMs9D2aR3neenQNHK1Mszd127MWVxRKgqiQWOWHY12+Umg9 MXUc/o3MI6H5nqeFWdnU9DQ9yRh7g6oxPCVZ84/FUdx/x+sfpxHzwkJi X-Gm-Gg: ASbGncv1jbWqySgCBPXg7Opt3cANiVtmcX7pkAz3Fv8Giz8HTJlvSDIRSTjOqVoxipd eX0jQ7RE0Mp81O+pCf1lMPhMZd521crMMcLfIwLehLjV/wKsteED6EV6pa/wFoBacEYwfzY9pWi RYun5MadBu1ry6OU0HLJl1zSmLW3mYy9qm0ROPIiQzvE2cCPoY3I3imUqD+z1GrGvvN2g99K3ru cJl7v23NB+5C+L0gf+v4Sp2Zj0I6F/oorG6bKJK/Gt65lVEzeAOReL8fA8EXxiRtfoxhUy0K2Ee 1mllbglA3PD1JAlT1EH49cXOGmzHpXQWWozalXPJYyMQJH3QohnvwkJWLDoF372IXHKjGruwk5K 8qrXSGbkQxDdi31HNmKz3eMsyo4dutXtHywEZLMd/vppZgfEiiKpLALPL2oShTIukp32aeLPlvQ == X-Google-Smtp-Source: AGHT+IGZAuguHs2vAFoS95VzADN/By/zVpX3eGPY3Q5ZY95Qs8yWuNrHeiJWEnxBhgf85YsKK7wXPg== X-Received: by 2002:a05:6000:2c0c:b0:3f1:5bdd:190a with SMTP id ffacd0b85a97d-42666ac3a16mr15370706f8f.3.1760446913058; Tue, 14 Oct 2025 06:01:53 -0700 (PDT) Received: from ?IPV6:2620:10d:c096:325:77fd:1068:74c8:af87? ([2620:10d:c092:600::1:7ec0]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-426ce5cf790sm22831336f8f.28.2025.10.14.06.01.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Oct 2025 06:01:52 -0700 (PDT) Message-ID: <2ebc6019-d8b6-4d6f-981e-a61819b67e19@gmail.com> Date: Tue, 14 Oct 2025 14:03:07 +0100 Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v5 00/24][pull request] Add support for providers with large rx buffer To: netdev@vger.kernel.org, io-uring@vger.kernel.org Cc: Michael Chan , Pavan Chebbi , Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , Simon Horman , Ilias Apalodimas , Mina Almasry , Willem de Bruijn , Dragos Tatulea , Saeed Mahameed , Tariq Toukan , Mark Bloch , David Wei , linux-kernel@vger.kernel.org References: Content-Language: en-US From: Pavel Begunkov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [asml.silence[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 Oops, should be 0/6 in the subject. On 10/14/25 14:01, Pavel Begunkov wrote: > Many modern network cards support configurable rx buffer lengths larger > than typically used PAGE_SIZE. When paired with hw-gro larger rx buffer > sizes can drastically reduce the number of buffers traversing the stack > and save a lot of processing time. Another benefit for memory providers > like zcrx is that the userspace will be getting larger contiguous chunks > as well. > > This series adds net infrastructure for memory providers configuring > the size and implements it for bnxt. It'll be used by io_uring/zcrx, > which is intentionally separated to simplify merging. You can find > a branch that includes zcrx changes at [1] and an example liburing > program at [3]. -- Pavel Begunkov From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id aHxUIQ5K7mjc0BIAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 13:03:10 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 13:03:10 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8egI-00000006wnQ-0mjp for hi@josie.lol; Tue, 14 Oct 2025 13:03:10 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9B8FD19A0181 for ; Tue, 14 Oct 2025 13:02:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E83F4314D04; Tue, 14 Oct 2025 13:00:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OlShYp1S" X-Original-To: io-uring@vger.kernel.org Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0290313E11 for ; Tue, 14 Oct 2025 13:00:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760446842; cv=none; b=h1rpaMbqmITC0Fl9A2rBY79EN1OhwU+FQX4Z37vv/BBJQq3cgZW2ayWkcC559/UScOWVwAT2J4oN/ApafzUVS2xU2pePjIYKxT0u/FYP1ju9T/HeS1b1R/sbLDb9gBCv2LsuzzDssV+82AI2Q9ka20QXuucvHckCgyILfb0sYVs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760446842; c=relaxed/simple; bh=HRBeeqncveoZFS7vcpAo1b3/1g5dn/bW6PkOv+8KzhQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Pa0risTCR4h+eO0WzCaqOh89bIgCl7RNAVkWDmQ0MRqKKV+VO92NvTGodmA+/eZ08QuUY9gzVfAjVDO0w86iUSg8npMHbHwxA4DLcOySDdL3TkS34+Xjsq3mvyMyK/pBJrjflymyo0zA2XNFGpmFeaYO8M/kqT2DikSvXc+EOyE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OlShYp1S; arc=none smtp.client-ip=209.85.221.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-42568669606so3887228f8f.2 for ; Tue, 14 Oct 2025 06:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760446839; x=1761051639; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Fr+blYainBcpT6wR27xzUZrr6kB24eyLx7MFFl01tLI=; b=OlShYp1S6wwr3A3l3D/OKq1RWcY7wjbrWDhM5KKUdElsltBDlIYZPuDuIeIBheWPDX G70nBH1jc+JSGI/04uLkWAPJ7s70pEFmxZiEOx/Dff+D5u6+tXyV4ZWmnjsypo2CMvJa 2QmzLDYAas4AXbdI7OEkVHOVIzbAustBzwz/SV5+IruPp7oSpS0C8VUSOrVK2SWSlRO0 BzLb+BqYb17tZnMAiVdyZXR9xtGOCXJc+Gok/Vtld7s90g3qCQYZG/aiwHk9P6CItY8z a0Wvi0YeIIEqc2ZWZQ7pVar91bLOD0qY2JdOVOq2F+G/hEuRXgxUbdNIviM/by9cZuP4 Ca/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760446839; x=1761051639; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Fr+blYainBcpT6wR27xzUZrr6kB24eyLx7MFFl01tLI=; b=tJ+2BOg/xTB6U6JqOoceWg2Omg08UPJOTTIufAWMJ3+eZPJ4eTzS3ToBbPJRPDs0tE wJwLzpGTSJt09X45ZkE9y2Qsqz7Ve88IPyQYb+YL1hbz3xq8xaYQZ1WTXck+f6hGtr2m TXtTmsAssGT5+gGcUBRG/o7eZ1HHwD4xxqNtpy0JhGSM+Vy4RCDLjIMJU7fj1ZZrjF+z VMH72KsgQQm9DvLT40muBK3R1aRmb7GMJauKLvNiFgQKDf8yb6g4xbrxTkLyR0BhrFrn IQNJjcTiqI0YahVjFdG129kZtivxjGx+OrN5V7ghtLF6551bqhAkMDf2sotn91m9dbzn FkiA== X-Forwarded-Encrypted: i=1; AJvYcCXepH5ZP48NV/joDgRxxPLQyhBJsxeoNP5Uchk9SmiZWVwumIphGebrAQmgQSw0EJf7pKsq+KYI5A==@vger.kernel.org X-Gm-Message-State: AOJu0Yw75yI191GbU9YQhYDzikg/XHv7BjgpvLzkTsRLIrLU6ksVmJl3 2QLFBRTzqjkxWhSZFg6MGq3ZmFoWj/bx3MKJsKlHvd1AqKIx84e3i6mm X-Gm-Gg: ASbGnct8K6heHyNrKOYrRZpR7PYaeJpxJjPDtjp6/X2WV550nf9TzsoMU8G2oYCas9h NniL0eyJT5fXk0I/kdKo7xh1FRloC6noFs4iSaIpbNa9EhtkZqtQvovyB0ABOMX0BWC525XuMGG TVD7VBKOsrSGcTxVAA9bV8vjPhVt9ByAfalxYy96/oU6x+yiyw0GT2+gf60G/VV5wc00ert07x4 sZybcYy2L2fExvHNwhD3ga0f1/J7nO747kSB6+ZjQt1oEIvzarPlLH7yLutBTa83Ue690o9tlls 62t6NMi0t85r+LzaU0YYvUhKHW4oA7TgHbYBfReBBRIKrUkNN7npb1yz7KvZs/05FIrHflnvScM fs8TWJEvc9o218eoIWWQD/Fl5 X-Google-Smtp-Source: AGHT+IGcoZuBqHvgvUSsgwLain+WF6qicDLZHuH6hV35Q+IUg9D7eRD2PZdvbylFSmz/OUoUDJoUoA== X-Received: by 2002:a5d:5889:0:b0:3fa:ff5d:c34a with SMTP id ffacd0b85a97d-4266e7e15bbmr17795709f8f.39.1760446839125; Tue, 14 Oct 2025 06:00:39 -0700 (PDT) Received: from 127.com ([2620:10d:c092:600::1:7ec0]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-426ce582b39sm23296494f8f.15.2025.10.14.06.00.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Oct 2025 06:00:38 -0700 (PDT) From: Pavel Begunkov To: netdev@vger.kernel.org, io-uring@vger.kernel.org Cc: Michael Chan , Pavan Chebbi , Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , Simon Horman , Ilias Apalodimas , Mina Almasry , Pavel Begunkov , Willem de Bruijn , Dragos Tatulea , Saeed Mahameed , Tariq Toukan , Mark Bloch , David Wei , linux-kernel@vger.kernel.org Subject: [PATCH net-next v5 6/6] eth: bnxt: allow providers to set rx buf size Date: Tue, 14 Oct 2025 14:01:26 +0100 Message-ID: X-Mailer: git-send-email 2.49.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [147.75.80.249 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [asml.silence[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: -18 Implement NDO_QUEUE_RX_BUF_SIZE and take the rx buf size from the memory providers. Signed-off-by: Pavel Begunkov --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 34 +++++++++++++++++++++++ drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + 2 files changed, 35 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 950e60d204cb..8d0e69dc900e 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -15906,16 +15906,46 @@ static const struct netdev_stat_ops bnxt_stat_ops = { .get_base_stats = bnxt_get_base_stats, }; +static ssize_t bnxt_get_rx_buf_size(struct bnxt *bp, int rxq_idx) +{ + struct netdev_rx_queue *rxq = __netif_get_rx_queue(bp->dev, rxq_idx); + size_t rx_buf_size; + + rx_buf_size = rxq->mp_params.rx_buf_len; + if (!rx_buf_size) + return BNXT_RX_PAGE_SIZE; + + /* Older chips need MSS calc so rx_buf_len is not supported, + * but we don't set queue ops for them so we should never get here. + */ + if (!(bp->flags & BNXT_FLAG_CHIP_P5_PLUS)) + return -EINVAL; + + if (!is_power_of_2(rx_buf_size)) + return -ERANGE; + + if (rx_buf_size < BNXT_RX_PAGE_SIZE || + rx_buf_size > BNXT_MAX_RX_PAGE_SIZE) + return -ERANGE; + + return rx_buf_size; +} + static int bnxt_queue_mem_alloc(struct net_device *dev, void *qmem, int idx) { struct bnxt_rx_ring_info *rxr, *clone; struct bnxt *bp = netdev_priv(dev); struct bnxt_ring_struct *ring; + ssize_t rx_buf_size; int rc; if (!bp->rx_ring) return -ENETDOWN; + rx_buf_size = bnxt_get_rx_buf_size(bp, idx); + if (rx_buf_size < 0) + return rx_buf_size; + rxr = &bp->rx_ring[idx]; clone = qmem; memcpy(clone, rxr, sizeof(*rxr)); @@ -15927,6 +15957,7 @@ static int bnxt_queue_mem_alloc(struct net_device *dev, void *qmem, int idx) clone->rx_sw_agg_prod = 0; clone->rx_next_cons = 0; clone->need_head_pool = false; + clone->rx_page_size = rx_buf_size; rc = bnxt_alloc_rx_page_pool(bp, clone, rxr->page_pool->p.nid); if (rc) @@ -16053,6 +16084,8 @@ static void bnxt_copy_rx_ring(struct bnxt *bp, src_ring = &src->rx_agg_ring_struct; src_rmem = &src_ring->ring_mem; + dst->rx_page_size = src->rx_page_size; + WARN_ON(dst_rmem->nr_pages != src_rmem->nr_pages); WARN_ON(dst_rmem->page_size != src_rmem->page_size); WARN_ON(dst_rmem->flags != src_rmem->flags); @@ -16205,6 +16238,7 @@ static const struct netdev_queue_mgmt_ops bnxt_queue_mgmt_ops = { .ndo_queue_mem_free = bnxt_queue_mem_free, .ndo_queue_start = bnxt_queue_start, .ndo_queue_stop = bnxt_queue_stop, + .supported_params = NDO_QUEUE_RX_BUF_SIZE, }; static void bnxt_remove_one(struct pci_dev *pdev) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index 3a53d9073c4d..d84c0de231b3 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -759,6 +759,7 @@ struct nqe_cn { #endif #define BNXT_RX_PAGE_SIZE (1 << BNXT_RX_PAGE_SHIFT) +#define BNXT_MAX_RX_PAGE_SIZE (1 << 15) #define BNXT_MAX_MTU 9500 -- 2.49.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id iGFYBD9K7mhCjBgAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 13:03:59 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 13:03:59 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8eh4-00000006y8x-36bp for hi@josie.lol; Tue, 14 Oct 2025 13:03:59 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0040D40382A for ; Tue, 14 Oct 2025 13:01:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 47E1F314B8A; Tue, 14 Oct 2025 13:00:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jso8Odz1" X-Original-To: io-uring@vger.kernel.org Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59D51314B69 for ; Tue, 14 Oct 2025 13:00:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760446842; cv=none; b=YXvWkGrrT6I6wKMvUtAucnJfvjRe3uVnDPMm99GYfP6wF60sKJ3EkjFRfZAnDQwVOGvpxf7lh/WCS8NQOnilQlrI9aP32AUeWxktQMy9aYuI0h/4KPe+c01mUmLO3PK75o+2Mlbkd7AjAwyhulCMgZiR8VQvWOtX9jkDtbIOT70= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760446842; c=relaxed/simple; bh=JM6u3rhenlQZWL+x7CQ4y9MfGHKPZFCJcJabv3mo818=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Kd8nnhKuPYk+nVNiWBxyCSqMWnIef3WKrKEhbQhPHmfeem4C8FzlTMmBoW+Oy9j8y6GOEDELMUVirKr+E5tLwoSOZCiflszBZ5sVQzmS9grM6sgszA39FhzjfBIuETjKNnsKG39RNKqYWPtd9aoUkNRXUJDlHyAzVcD7YocBGzg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jso8Odz1; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-3f0ae439bc3so2413556f8f.1 for ; Tue, 14 Oct 2025 06:00:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760446838; x=1761051638; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bo/Hffm+GCU38S4s9L6o3lMbhm24x5k4XXoTTrdb28c=; b=jso8Odz1yFP3cru5SQvAzTlVeY1SzIsJPQ8CL7JoJKQRHFnLimrxUNtmu6VNhitd8o GCuDy+YaHfp9v2I2vlBdhwNRQZcVoqJF2q7BLe90chXwaDPLFkpRIBVEYK+9qhMM5BQL RoMpA8nd8FkFrSi9bbIZfTrbSX4Q3Vak0SeS5KMx8aZoNbVikx7eOhHQ9w2WR/biZpnK 9FkMIzaBwo/Jk8vNg54u0T7Au071mqsgeV2aNMNWMu0XJf8f2Tw7Zrx4mXoqnxYnaYfv eiwCkOTURKBRyKn0cbDWDW31dORZLKQnGyigivywUGF/spGxo1Q9ke0c/CX40SHjKwjW mFPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760446838; x=1761051638; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bo/Hffm+GCU38S4s9L6o3lMbhm24x5k4XXoTTrdb28c=; b=SBgnXnaUWv6Z7ZYeQv1brd61XwklZnhYagn1BTuQT5beMLsU3EKMTvHfR5yC/gskKy fKw4g/blOzeIYEfy7u3pOBmPLa7/R+O4bGXhPHN1o3kClSK7dvp2JNXEJh3B9ZluZ7ac ZH/8+IRCfmAYsqO3TNsYsTrCfYDyd1uiB3XY5BT4dh19gzypX33PnabaFb7k3pnVmb/h W9nSpu0F3E/WZvB87J/IgUH+YnBynABpp4rX0Qwd4ZaGaJsAKlB027l6BxwgdhgWkA3p O0ERhTvM2RmQsw1x6daFsWrLWp7a2F7zXk/KSPhE3C2zm8JZxnjKuKAKNWEtYEb7p+6D jGqw== X-Forwarded-Encrypted: i=1; AJvYcCVAnWr7SkbXJCKRT8rQtJ2pZikQJB9b3WK7D8ss6ZFnQWeozAUIvezBowG6SUYiQ/ewkHI8Cz/SPA==@vger.kernel.org X-Gm-Message-State: AOJu0Yw1F0CQ/aV6Vnno9unlVjMcZK/zWXbHoH9LGXVKYWD1knr90Anu 0EK2Nr+9oJEtjyAqZfAxb5sRKgbPWTdNXpoayx30n89bkDmypfXebzh8 X-Gm-Gg: ASbGncvbga28oOfVOHiUFAREcX4nSo+QR8O/HMl4tcRkcPoyciwpF0x/QMKR9rW/yDF 3lyXC4bmMLtRC35p6F44Ovjdnr7rDaDdwCN2C5WEZ3MySSdy1Fn4/BNGQf3/i+lK4gyl57LxY1F RDOVV8fsF5kvvWUJ7Bvz7vIjY/O5St+R5pd2F4hXjEAYA0PSsf3IqFABSPv72LphF5hfsZQy7Fg 3aCfyI3YHOiqHEFjP/yXWfgcC/d3zYlnLymLE/nQiMo7PT47LW0diJBk58ye3AoiWatof+qykWt ewR/85XMVmn2nkWhosjlFn4dhxZnzGIaWnA7Y8wRKfBIl0Jz6/GNu0jSaMVTe3ZvSk8qmXbQHsc MKLchsW3bSQuZImCXDrJIJntu X-Google-Smtp-Source: AGHT+IGhSZFm38F8sVCM0Ux5ROYmcmMusBWqctwDSzojJka/K/RPf3AoV/TQmhhmAwvujH6biaI4iA== X-Received: by 2002:a05:6000:601:b0:3d7:2284:b20 with SMTP id ffacd0b85a97d-42666ab296fmr16323066f8f.3.1760446837436; Tue, 14 Oct 2025 06:00:37 -0700 (PDT) Received: from 127.com ([2620:10d:c092:600::1:7ec0]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-426ce582b39sm23296494f8f.15.2025.10.14.06.00.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Oct 2025 06:00:36 -0700 (PDT) From: Pavel Begunkov To: netdev@vger.kernel.org, io-uring@vger.kernel.org Cc: Michael Chan , Pavan Chebbi , Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , Simon Horman , Ilias Apalodimas , Mina Almasry , Pavel Begunkov , Willem de Bruijn , Dragos Tatulea , Saeed Mahameed , Tariq Toukan , Mark Bloch , David Wei , linux-kernel@vger.kernel.org Subject: [PATCH net-next v5 5/6] eth: bnxt: adjust the fill level of agg queues with larger buffers Date: Tue, 14 Oct 2025 14:01:25 +0100 Message-ID: <1a9ae7fc9d06111b14f29d0b81ceae9841056bf9.1760440268.git.asml.silence@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [asml.silence[at]gmail.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 From: Jakub Kicinski The driver tries to provision more agg buffers than header buffers since multiple agg segments can reuse the same header. The calculation / heuristic tries to provide enough pages for 65k of data for each header (or 4 frags per header if the result is too big). This calculation is currently global to the adapter. If we increase the buffer sizes 8x we don't want 8x the amount of memory sitting on the rings. Luckily we don't have to fill the rings completely, adjust the fill level dynamically in case particular queue has buffers larger than the global size. Signed-off-by: Jakub Kicinski [pavel: rebase on top of agg_size_fac, assert agg_size_fac] Signed-off-by: Pavel Begunkov --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 28 +++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 61943de13774..950e60d204cb 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -3816,16 +3816,34 @@ static void bnxt_free_rx_rings(struct bnxt *bp) } } +static int bnxt_rx_agg_ring_fill_level(struct bnxt *bp, + struct bnxt_rx_ring_info *rxr) +{ + /* User may have chosen larger than default rx_page_size, + * we keep the ring sizes uniform and also want uniform amount + * of bytes consumed per ring, so cap how much of the rings we fill. + */ + int fill_level = bp->rx_agg_ring_size; + + if (rxr->rx_page_size > BNXT_RX_PAGE_SIZE) + fill_level /= rxr->rx_page_size / BNXT_RX_PAGE_SIZE; + + return fill_level; +} + static int bnxt_alloc_rx_page_pool(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, int numa_node) { - const unsigned int agg_size_fac = PAGE_SIZE / BNXT_RX_PAGE_SIZE; + unsigned int agg_size_fac = rxr->rx_page_size / BNXT_RX_PAGE_SIZE; const unsigned int rx_size_fac = PAGE_SIZE / SZ_4K; struct page_pool_params pp = { 0 }; struct page_pool *pool; - pp.pool_size = bp->rx_agg_ring_size / agg_size_fac; + if (WARN_ON_ONCE(agg_size_fac == 0)) + agg_size_fac = 1; + + pp.pool_size = bnxt_rx_agg_ring_fill_level(bp, rxr) / agg_size_fac; if (BNXT_RX_PAGE_MODE(bp)) pp.pool_size += bp->rx_ring_size / rx_size_fac; @@ -4403,11 +4421,13 @@ static void bnxt_alloc_one_rx_ring_netmem(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, int ring_nr) { + int fill_level, i; u32 prod; - int i; + + fill_level = bnxt_rx_agg_ring_fill_level(bp, rxr); prod = rxr->rx_agg_prod; - for (i = 0; i < bp->rx_agg_ring_size; i++) { + for (i = 0; i < fill_level; i++) { if (bnxt_alloc_rx_netmem(bp, rxr, prod, GFP_KERNEL)) { netdev_warn(bp->dev, "init'ed rx ring %d with %d/%d pages only\n", ring_nr, i, bp->rx_agg_ring_size); -- 2.49.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id +KljJ+dJ7mhUrxEAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 13:02:31 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 13:02:31 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8efe-00000006vVC-3yE9 for hi@josie.lol; Tue, 14 Oct 2025 13:02:31 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5454C188B96A for ; Tue, 14 Oct 2025 13:02:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 142711E5B60; Tue, 14 Oct 2025 13:00:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PvJNiLeM" X-Original-To: io-uring@vger.kernel.org Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE8FA313E11 for ; Tue, 14 Oct 2025 13:00:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760446840; cv=none; b=DaXGmL2F0IvsX+o8tiDgKaDrsJhhjg3Bq0x7vWz/XRN7ZSvq6iYFAiQo4ems9GqFdXeAJq/9SWCAP0AW+fQcxXeqT7VZECzBa6EDxaAgOrGEU+qDle5xqanHw2ap5cHm8dyyX1WsuL5BPa2CCuU6lBv1cJ8aWkZ6VeZytGIfvC4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760446840; c=relaxed/simple; bh=M0REHDyt578OqH5zyFtMqGb7x4CQnORClt3xbvZx53M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V+1rt7qijQWc3WP7xjLpFnZOYIMgIAq0M91yFuh8VPsTybzQ9gk8axdUoukFq35Y89nRH2mw0HNKBADBvX5tr1SDlJeTsGWmUZF/WGpcuV1ggeVOgJ1PKGpo7VHYoUphrktyoKaspe8REVKbACiLcWnWsdbvc+LC+YS2Ll59/o8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=PvJNiLeM; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-46e37d10ed2so49035475e9.2 for ; Tue, 14 Oct 2025 06:00:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760446836; x=1761051636; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mYJMxgYTe74CLLuwZmCpP4FS0BLjrIx+iEJSltbjOfo=; b=PvJNiLeMtJCZH8HrO/Bhh6ex2OoOJEILRtC/HYgz+3RKKdSL0c0qrc525DJrhUV3wV S7HksPxI+84pVYN1COpKUCDB6Qqhf/ihYsLOKc0aKpn0QL/MNtYnNYBRwhww8jSVLg4b Y4obfpc+EzugQWSY48wu14TgoQpCzuwDreLRgUX3ftpMV8MXpNkY/7tzWuukI9Iz0Qr9 3kz56dia+M+4OI5gCs0fKS0v3VBKe+x6W578kJLdjviA4cHBzqmSLOWUNo8kb+5oZc5G 3xHHomwha0Fm8xvKOnlihI8Wj3pkJT7wxKQuvdiqOhXvFUGYdeJUtZR3sQb14i8UTGdh S6kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760446836; x=1761051636; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mYJMxgYTe74CLLuwZmCpP4FS0BLjrIx+iEJSltbjOfo=; b=S4SlHZIdy/Ft/se9iTkIuGiI2wVJnteuTb/EPV3gD74LN8hlJPdrcS/vXAhvGHlG3Z 8/xE9BTmQ6K7d0odvFd7u6eXLlBf1/v5wXknxwbggEIywgucpnF7ohISRuB079UoQUAD B5WXfYkfqlIqXDpIw0nNwmyiQwccvhjZIT5HUWz5AvVBhkIPmklk7P0E9hTg8aHoTYZr PnKrL8L+wz2AqSuZAY+NDNNhAz6Z9f/kLLuJSKF6W/yifYRVy+vJT6fiLcKtunrV85DS CqisGE8DrBGrK+gcjGp2J46mi0a8Ga8B5BkNogmvhNCaYoZT4aDBqd9KUpqX9WzipTla 4HsA== X-Forwarded-Encrypted: i=1; AJvYcCX9/xINXOmO+nAcz7yEkQ2Pn1BqX6bAFmJQ/MWES95asfJpdLMAohm6gDCMRgS6qx7jTFu2cj3F5w==@vger.kernel.org X-Gm-Message-State: AOJu0Yz/orEjYqR2DtUchVfyb8c7wkP/gOSWkObITsVxC+BvmK3MaCKw WoPHLj5Zej21NuI3959db8LwIYfadzjgTAG/tY/j/p26OKocmHrZty7I X-Gm-Gg: ASbGncvqghaAq+l2c1GE8+PIi5s8xF+XKLEsVpBXIV/XVaonJ1EhrsubOeq1HtPWDDI 3X1RlrMctrowCYP4jSH8YF33XuNEnm/XvSXDLRSIHUtwhCyhbtA2lVEVrFXIbtgmW/tAHS1Z8fn vm0wqp/y1Mx4mXQXNkt9eBeNUXnc2kYN1nyyDaeP8QpkrjEFWyQKnEIyMdXspElTWLLmDrcDwOj n8JRHUY+2Smyp07Y7WUc5rg3n+C7qLCT0MJSvNJBqoghmdbBjEo6ZDX3yVg1WUn7cOzsKEzbRxd AZheQ1K/MnKoJW72CUR7emIw7iatXvCEOTmHWiC5vHAJhBuLksQ/vuwpk+1M+NJEsYX9bjxqMvR wBTiJGxWJFfujafv0bn1nYPcHHwgtUHu+9SY= X-Google-Smtp-Source: AGHT+IG8gQiOUAhrXLmuanEg8x33rpxDKEKrrObCED0k0rlwiHxLgtoj588KjHFsmacUbRN+mJsSVw== X-Received: by 2002:a05:600c:4e93:b0:459:d3ce:2cbd with SMTP id 5b1f17b1804b1-46fa9aa20b9mr162679455e9.13.1760446835843; Tue, 14 Oct 2025 06:00:35 -0700 (PDT) Received: from 127.com ([2620:10d:c092:600::1:7ec0]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-426ce582b39sm23296494f8f.15.2025.10.14.06.00.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Oct 2025 06:00:34 -0700 (PDT) From: Pavel Begunkov To: netdev@vger.kernel.org, io-uring@vger.kernel.org Cc: Michael Chan , Pavan Chebbi , Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , Simon Horman , Ilias Apalodimas , Mina Almasry , Pavel Begunkov , Willem de Bruijn , Dragos Tatulea , Saeed Mahameed , Tariq Toukan , Mark Bloch , David Wei , linux-kernel@vger.kernel.org Subject: [PATCH net-next v5 4/6] eth: bnxt: store rx buffer size per queue Date: Tue, 14 Oct 2025 14:01:24 +0100 Message-ID: <604282a434f1bd382863fa8548a102febc3ee265.1760440268.git.asml.silence@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [147.75.80.249 listed in list.dnswl.org] 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: pp.dev] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [asml.silence[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: -18 Instead of using a constant buffer length, allow configuring the size for each queue separately. There is no way to change the length yet, and it'll be passed from memory providers in a later patch. Suggested-by: Jakub Kicinski Signed-off-by: Pavel Begunkov --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 56 +++++++++++-------- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 6 +- drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.h | 2 +- 4 files changed, 38 insertions(+), 27 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 3fc33b1b4dfb..61943de13774 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -905,7 +905,7 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int budget) static bool bnxt_separate_head_pool(struct bnxt_rx_ring_info *rxr) { - return rxr->need_head_pool || PAGE_SIZE > BNXT_RX_PAGE_SIZE; + return rxr->need_head_pool || rxr->rx_page_size < PAGE_SIZE; } static struct page *__bnxt_alloc_rx_page(struct bnxt *bp, dma_addr_t *mapping, @@ -915,9 +915,9 @@ static struct page *__bnxt_alloc_rx_page(struct bnxt *bp, dma_addr_t *mapping, { struct page *page; - if (PAGE_SIZE > BNXT_RX_PAGE_SIZE) { + if (rxr->rx_page_size < PAGE_SIZE) { page = page_pool_dev_alloc_frag(rxr->page_pool, offset, - BNXT_RX_PAGE_SIZE); + rxr->rx_page_size); } else { page = page_pool_dev_alloc_pages(rxr->page_pool); *offset = 0; @@ -936,8 +936,9 @@ static netmem_ref __bnxt_alloc_rx_netmem(struct bnxt *bp, dma_addr_t *mapping, { netmem_ref netmem; - if (PAGE_SIZE > BNXT_RX_PAGE_SIZE) { - netmem = page_pool_alloc_frag_netmem(rxr->page_pool, offset, BNXT_RX_PAGE_SIZE, gfp); + if (rxr->rx_page_size < PAGE_SIZE) { + netmem = page_pool_alloc_frag_netmem(rxr->page_pool, offset, + rxr->rx_page_size, gfp); } else { netmem = page_pool_alloc_netmems(rxr->page_pool, gfp); *offset = 0; @@ -1155,9 +1156,9 @@ static struct sk_buff *bnxt_rx_multi_page_skb(struct bnxt *bp, return NULL; } dma_addr -= bp->rx_dma_offset; - dma_sync_single_for_cpu(&bp->pdev->dev, dma_addr, BNXT_RX_PAGE_SIZE, + dma_sync_single_for_cpu(&bp->pdev->dev, dma_addr, rxr->rx_page_size, bp->rx_dir); - skb = napi_build_skb(data_ptr - bp->rx_offset, BNXT_RX_PAGE_SIZE); + skb = napi_build_skb(data_ptr - bp->rx_offset, rxr->rx_page_size); if (!skb) { page_pool_recycle_direct(rxr->page_pool, page); return NULL; @@ -1189,7 +1190,7 @@ static struct sk_buff *bnxt_rx_page_skb(struct bnxt *bp, return NULL; } dma_addr -= bp->rx_dma_offset; - dma_sync_single_for_cpu(&bp->pdev->dev, dma_addr, BNXT_RX_PAGE_SIZE, + dma_sync_single_for_cpu(&bp->pdev->dev, dma_addr, rxr->rx_page_size, bp->rx_dir); if (unlikely(!payload)) @@ -1203,7 +1204,7 @@ static struct sk_buff *bnxt_rx_page_skb(struct bnxt *bp, skb_mark_for_recycle(skb); off = (void *)data_ptr - page_address(page); - skb_add_rx_frag(skb, 0, page, off, len, BNXT_RX_PAGE_SIZE); + skb_add_rx_frag(skb, 0, page, off, len, rxr->rx_page_size); memcpy(skb->data - NET_IP_ALIGN, data_ptr - NET_IP_ALIGN, payload + NET_IP_ALIGN); @@ -1288,7 +1289,7 @@ static u32 __bnxt_rx_agg_netmems(struct bnxt *bp, if (skb) { skb_add_rx_frag_netmem(skb, i, cons_rx_buf->netmem, cons_rx_buf->offset, - frag_len, BNXT_RX_PAGE_SIZE); + frag_len, rxr->rx_page_size); } else { skb_frag_t *frag = &shinfo->frags[i]; @@ -1313,7 +1314,7 @@ static u32 __bnxt_rx_agg_netmems(struct bnxt *bp, if (skb) { skb->len -= frag_len; skb->data_len -= frag_len; - skb->truesize -= BNXT_RX_PAGE_SIZE; + skb->truesize -= rxr->rx_page_size; } --shinfo->nr_frags; @@ -1328,7 +1329,7 @@ static u32 __bnxt_rx_agg_netmems(struct bnxt *bp, } page_pool_dma_sync_netmem_for_cpu(rxr->page_pool, netmem, 0, - BNXT_RX_PAGE_SIZE); + rxr->rx_page_size); total_frag_len += frag_len; prod = NEXT_RX_AGG(prod); @@ -2281,8 +2282,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, if (!skb) goto oom_next_rx; } else { - skb = bnxt_xdp_build_skb(bp, skb, agg_bufs, - rxr->page_pool, &xdp); + skb = bnxt_xdp_build_skb(bp, skb, agg_bufs, rxr, &xdp); if (!skb) { /* we should be able to free the old skb here */ bnxt_xdp_buff_frags_free(rxr, &xdp); @@ -3828,11 +3828,13 @@ static int bnxt_alloc_rx_page_pool(struct bnxt *bp, pp.pool_size = bp->rx_agg_ring_size / agg_size_fac; if (BNXT_RX_PAGE_MODE(bp)) pp.pool_size += bp->rx_ring_size / rx_size_fac; + + pp.order = get_order(rxr->rx_page_size); pp.nid = numa_node; pp.netdev = bp->dev; pp.dev = &bp->pdev->dev; pp.dma_dir = bp->rx_dir; - pp.max_len = PAGE_SIZE; + pp.max_len = PAGE_SIZE << pp.order; pp.flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV | PP_FLAG_ALLOW_UNREADABLE_NETMEM; pp.queue_idx = rxr->bnapi->index; @@ -3843,7 +3845,10 @@ static int bnxt_alloc_rx_page_pool(struct bnxt *bp, rxr->page_pool = pool; rxr->need_head_pool = page_pool_is_unreadable(pool); + rxr->need_head_pool |= !!pp.order; if (bnxt_separate_head_pool(rxr)) { + pp.order = 0; + pp.max_len = PAGE_SIZE; pp.pool_size = min(bp->rx_ring_size / rx_size_fac, 1024); pp.flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV; pool = page_pool_create(&pp); @@ -4319,6 +4324,8 @@ static void bnxt_init_ring_struct(struct bnxt *bp) if (!rxr) goto skip_rx; + rxr->rx_page_size = BNXT_RX_PAGE_SIZE; + ring = &rxr->rx_ring_struct; rmem = &ring->ring_mem; rmem->nr_pages = bp->rx_nr_pages; @@ -4478,7 +4485,7 @@ static void bnxt_init_one_rx_agg_ring_rxbd(struct bnxt *bp, ring = &rxr->rx_agg_ring_struct; ring->fw_ring_id = INVALID_HW_RING_ID; if ((bp->flags & BNXT_FLAG_AGG_RINGS)) { - type = ((u32)BNXT_RX_PAGE_SIZE << RX_BD_LEN_SHIFT) | + type = ((u32)rxr->rx_page_size << RX_BD_LEN_SHIFT) | RX_BD_TYPE_RX_AGG_BD | RX_BD_FLAGS_SOP; bnxt_init_rxbd_pages(ring, type); @@ -7045,6 +7052,7 @@ static void bnxt_hwrm_ring_grp_free(struct bnxt *bp) static void bnxt_set_rx_ring_params_p5(struct bnxt *bp, u32 ring_type, struct hwrm_ring_alloc_input *req, + struct bnxt_rx_ring_info *rxr, struct bnxt_ring_struct *ring) { struct bnxt_ring_grp_info *grp_info = &bp->grp_info[ring->grp_idx]; @@ -7054,7 +7062,7 @@ static void bnxt_set_rx_ring_params_p5(struct bnxt *bp, u32 ring_type, if (ring_type == HWRM_RING_ALLOC_AGG) { req->ring_type = RING_ALLOC_REQ_RING_TYPE_RX_AGG; req->rx_ring_id = cpu_to_le16(grp_info->rx_fw_ring_id); - req->rx_buf_size = cpu_to_le16(BNXT_RX_PAGE_SIZE); + req->rx_buf_size = cpu_to_le16(rxr->rx_page_size); enables |= RING_ALLOC_REQ_ENABLES_RX_RING_ID_VALID; } else { req->rx_buf_size = cpu_to_le16(bp->rx_buf_use_size); @@ -7068,6 +7076,7 @@ static void bnxt_set_rx_ring_params_p5(struct bnxt *bp, u32 ring_type, } static int hwrm_ring_alloc_send_msg(struct bnxt *bp, + struct bnxt_rx_ring_info *rxr, struct bnxt_ring_struct *ring, u32 ring_type, u32 map_index) { @@ -7124,7 +7133,8 @@ static int hwrm_ring_alloc_send_msg(struct bnxt *bp, cpu_to_le32(bp->rx_ring_mask + 1) : cpu_to_le32(bp->rx_agg_ring_mask + 1); if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) - bnxt_set_rx_ring_params_p5(bp, ring_type, req, ring); + bnxt_set_rx_ring_params_p5(bp, ring_type, req, + rxr, ring); break; case HWRM_RING_ALLOC_CMPL: req->ring_type = RING_ALLOC_REQ_RING_TYPE_L2_CMPL; @@ -7272,7 +7282,7 @@ static int bnxt_hwrm_rx_ring_alloc(struct bnxt *bp, u32 map_idx = bnapi->index; int rc; - rc = hwrm_ring_alloc_send_msg(bp, ring, type, map_idx); + rc = hwrm_ring_alloc_send_msg(bp, rxr, ring, type, map_idx); if (rc) return rc; @@ -7292,7 +7302,7 @@ static int bnxt_hwrm_rx_agg_ring_alloc(struct bnxt *bp, int rc; map_idx = grp_idx + bp->rx_nr_rings; - rc = hwrm_ring_alloc_send_msg(bp, ring, type, map_idx); + rc = hwrm_ring_alloc_send_msg(bp, rxr, ring, type, map_idx); if (rc) return rc; @@ -7316,7 +7326,7 @@ static int bnxt_hwrm_cp_ring_alloc_p5(struct bnxt *bp, ring = &cpr->cp_ring_struct; ring->handle = BNXT_SET_NQ_HDL(cpr); - rc = hwrm_ring_alloc_send_msg(bp, ring, type, map_idx); + rc = hwrm_ring_alloc_send_msg(bp, NULL, ring, type, map_idx); if (rc) return rc; bnxt_set_db(bp, &cpr->cp_db, type, map_idx, ring->fw_ring_id); @@ -7331,7 +7341,7 @@ static int bnxt_hwrm_tx_ring_alloc(struct bnxt *bp, const u32 type = HWRM_RING_ALLOC_TX; int rc; - rc = hwrm_ring_alloc_send_msg(bp, ring, type, tx_idx); + rc = hwrm_ring_alloc_send_msg(bp, NULL, ring, type, tx_idx); if (rc) return rc; bnxt_set_db(bp, &txr->tx_db, type, tx_idx, ring->fw_ring_id); @@ -7357,7 +7367,7 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp) vector = bp->irq_tbl[map_idx].vector; disable_irq_nosync(vector); - rc = hwrm_ring_alloc_send_msg(bp, ring, type, map_idx); + rc = hwrm_ring_alloc_send_msg(bp, NULL, ring, type, map_idx); if (rc) { enable_irq(vector); goto err_out; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index 741b2d854789..3a53d9073c4d 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -1106,6 +1106,7 @@ struct bnxt_rx_ring_info { unsigned long *rx_agg_bmap; u16 rx_agg_bmap_size; + u16 rx_page_size; bool need_head_pool; dma_addr_t rx_desc_mapping[MAX_RX_PAGES]; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c index 3e77a96e5a3e..619235b151a4 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c @@ -183,7 +183,7 @@ void bnxt_xdp_buff_init(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, u16 cons, u8 *data_ptr, unsigned int len, struct xdp_buff *xdp) { - u32 buflen = BNXT_RX_PAGE_SIZE; + u32 buflen = rxr->rx_page_size; struct bnxt_sw_rx_bd *rx_buf; struct pci_dev *pdev; dma_addr_t mapping; @@ -461,7 +461,7 @@ int bnxt_xdp(struct net_device *dev, struct netdev_bpf *xdp) struct sk_buff * bnxt_xdp_build_skb(struct bnxt *bp, struct sk_buff *skb, u8 num_frags, - struct page_pool *pool, struct xdp_buff *xdp) + struct bnxt_rx_ring_info *rxr, struct xdp_buff *xdp) { struct skb_shared_info *sinfo = xdp_get_shared_info_from_buff(xdp); @@ -469,7 +469,7 @@ bnxt_xdp_build_skb(struct bnxt *bp, struct sk_buff *skb, u8 num_frags, return NULL; xdp_update_skb_frags_info(skb, num_frags, sinfo->xdp_frags_size, - BNXT_RX_PAGE_SIZE * num_frags, + rxr->rx_page_size * num_frags, xdp_buff_get_skb_flags(xdp)); return skb; } diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.h index 220285e190fc..8933a0dec09a 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.h @@ -32,6 +32,6 @@ void bnxt_xdp_buff_init(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, void bnxt_xdp_buff_frags_free(struct bnxt_rx_ring_info *rxr, struct xdp_buff *xdp); struct sk_buff *bnxt_xdp_build_skb(struct bnxt *bp, struct sk_buff *skb, - u8 num_frags, struct page_pool *pool, + u8 num_frags, struct bnxt_rx_ring_info *rxr, struct xdp_buff *xdp); #endif -- 2.49.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id yG+MIqNJ7miJuxgAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 13:01:23 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 13:01:23 +0000 Received: from ams.mirrors.kernel.org ([213.196.21.55]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8eeY-00000006sRs-4AQ7 for hi@josie.lol; Tue, 14 Oct 2025 13:01:23 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.mirrors.kernel.org (Postfix) with ESMTPS id D1784354888 for ; Tue, 14 Oct 2025 13:01:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 17C43313E33; Tue, 14 Oct 2025 13:00:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jNJxVwN7" X-Original-To: io-uring@vger.kernel.org Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 330FB3148D1 for ; Tue, 14 Oct 2025 13:00:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760446838; cv=none; b=DUPLe32z0NbVn25zdKVilbO9U8QJ641ob8tx6KX4YCe4IpRRlRLEJOK+Gk2hxWpDjzItz4knO5xKwy25rd4ts37kiqS2zYzOUsKUO/LEuOcefM9QlGE/tgz6jXLUc7LVnOftKHl+IwVFizy8N75lhqAGxtsaeesUQDxRKQcdPZM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760446838; c=relaxed/simple; bh=O4ZG85nDGPd7PXtgdg5RSs+JAoveNaHnwwLAEnHUcfc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qYh86jG+t9Y7z2HYXkfiWjT4B1W6ZwFiMAmArPR8jeO0YOiGE7A/oDO0b4zNICef8rmu65dxShImEyrH3yhiS26rI4HZk9J6g7Np56Tx+IzPo0DU5EbU/iPNJAO5sLtiKOpucxlhMZBBTzNKiF9NnS4DfFFaeSacwPEixeDyvP4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jNJxVwN7; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-46e6a689bd0so38445665e9.1 for ; Tue, 14 Oct 2025 06:00:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760446834; x=1761051634; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PKwnnsbFaZewVWohwl3HgurKLHOdfvo9hMFu7wHJP0I=; b=jNJxVwN7jtfAEHwYh89wIOWMY4ueO/AJFoLAOtsDzTmhYHUByWBM8OxaicH2yw4oSK i8ypgxoNEOQX+hckLc67YcaMxTs2tPUDgS0QlehK4bO/DDdiUvNemeTivKzcz9ZCBSOR mCrhNV8uV9iKa0zEK1HUoZ6kJcYQorLOSSmvaJQdgNiw6O+HmODRQTTWD1CI0b4stThm k/jvPIgBOK9nhJ67HMLREtkMTlkwl7RpL+HVdrQsNgy+yKZt2iQRsRPkNYChD3NdI6c3 zSSa1ZnEoaiV3yVvHBwgebzWaCQboJ/MMxxJpbw4fMWuHzGnFMqNuh6gzWWIqbaf3Obq 4weQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760446834; x=1761051634; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PKwnnsbFaZewVWohwl3HgurKLHOdfvo9hMFu7wHJP0I=; b=vQgSubPBlXoxTkD3aFl6V7Z1yijUL+v2avnH0oDdkUDAabCBJPlVIV5VxaoJOrEIqp iS9nK7qtcVp8GVYIAU+F2FunpgcTVZ6LLGri3u83jXqr4JsSF125A19Xr1F2HUJIW1TF i9AUB2rvRsnfIrUvMWeigoC/wm+h50OUk93Fuqmg7pm/fwD4KJeIFxtaiFnBToQiU+tO 0fMTcct7G4zWkU4UBQ3eFwRUdH0DTJVFp3Wc8JdtirLTgO3azSVEF/2WJ1sLUHovpGC2 FSaiVXCpiYR+pN0uMWW6xiyK+j4WCCzZqAv93LgFnDpxUpfuZaYG2zTixEtc/eZqedyw PiNQ== X-Forwarded-Encrypted: i=1; AJvYcCWYQN1h9OnTzKoMLIR/lAHqWRJid00enWaw4oPKSFx5Qf8+ODry0rnb2cNsICAJLW30VqhDy3w/JQ==@vger.kernel.org X-Gm-Message-State: AOJu0Ywbk+TYLbAarZcFWnnL/vqCcukT3hP+8b+ZJYXnXP5KITw2eWso 1718NI4tTL5D8tdEMvaUx6/7Vn8k72FqXIB8TQmXqpfG1jJnHc8j4Ff9eIYYp0BY X-Gm-Gg: ASbGncvnN4SaNPovSWcrQRmazmHF1BOU6+KBoCrM/qy7wkwHj/DEPNm9910E0+97lFe 117VBlsQBx633FF/jrYUnJk9YQv4zmqN8byUmWgCarf41jCmo9LzfPHVcyjz+tVwpGcaoUyDJWb SV51yif4blaZIOv+7XRwCqr8RtOCaUxVCQqooZKs/sM4MLApuU5yxbLQTgHzt+ejhw1jQqrbsjw ZrdDR9NN7Tuwn0RMyaohSqgZYYNtg2KySorYgcwQ6jdAl3Vl+MULR7rIP3lAVYjeD3FHm8IYAPa 49SbunNSxY1ORf51TeMQ7pFTNweRDdvhfwjv8nsrzdn0ShHBF/nXeAUxquvWTTrhea7Rw76/U0V rWaDuwT8hRdoN7AGIjiupI+3l53LoJT9anjQ= X-Google-Smtp-Source: AGHT+IEsNg5cq0AbDD8HDQZYEec1USvgiKJ8GhktxA14/2sy5dbkpcXRXDd8Llt0GD6ejRT66hW41A== X-Received: by 2002:a05:600c:3b2a:b0:461:8bdb:e8 with SMTP id 5b1f17b1804b1-46fa9b06c50mr186231295e9.30.1760446833629; Tue, 14 Oct 2025 06:00:33 -0700 (PDT) Received: from 127.com ([2620:10d:c092:600::1:7ec0]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-426ce582b39sm23296494f8f.15.2025.10.14.06.00.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Oct 2025 06:00:32 -0700 (PDT) From: Pavel Begunkov To: netdev@vger.kernel.org, io-uring@vger.kernel.org Cc: Michael Chan , Pavan Chebbi , Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , Simon Horman , Ilias Apalodimas , Mina Almasry , Pavel Begunkov , Willem de Bruijn , Dragos Tatulea , Saeed Mahameed , Tariq Toukan , Mark Bloch , David Wei , linux-kernel@vger.kernel.org Subject: [PATCH net-next v5 3/6] net: let pp memory provider to specify rx buf len Date: Tue, 14 Oct 2025 14:01:23 +0100 Message-ID: <363ecb9e10c64fd6c3a961c93879431d99601114.1760440268.git.asml.silence@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [213.196.21.55 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [asml.silence[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 Allow memory providers to configure rx queues with a specific receive buffer length. Pass it in struct pp_memory_provider_params, which is copied into the queue, so it's preserved across queue restarts. It's an opt-in feature for drivers, which they can enable by setting NDO_QUEUE_RX_BUF_SIZE to their struct netdev_queue_mgmt_ops. Signed-off-by: Pavel Begunkov --- include/net/netdev_queues.h | 9 +++++++++ include/net/page_pool/types.h | 1 + net/core/netdev_rx_queue.c | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/include/net/netdev_queues.h b/include/net/netdev_queues.h index cd00e0406cf4..2e6bcec1e1e3 100644 --- a/include/net/netdev_queues.h +++ b/include/net/netdev_queues.h @@ -111,6 +111,11 @@ void netdev_stat_queue_sum(struct net_device *netdev, int tx_start, int tx_end, struct netdev_queue_stats_tx *tx_sum); +enum { + /* queue restart support custom rx buffer sizes */ + NDO_QUEUE_RX_BUF_SIZE = 0x1, +}; + /** * struct netdev_queue_mgmt_ops - netdev ops for queue management * @@ -130,6 +135,8 @@ void netdev_stat_queue_sum(struct net_device *netdev, * @ndo_queue_get_dma_dev: Get dma device for zero-copy operations to be used * for this queue. Return NULL on error. * + * @supported_params: bitmask of supported features, see NDO_QUEUE_* + * * Note that @ndo_queue_mem_alloc and @ndo_queue_mem_free may be called while * the interface is closed. @ndo_queue_start and @ndo_queue_stop will only * be called for an interface which is open. @@ -149,6 +156,8 @@ struct netdev_queue_mgmt_ops { int idx); struct device * (*ndo_queue_get_dma_dev)(struct net_device *dev, int idx); + + unsigned supported_params; }; bool netif_rxq_has_unreadable_mp(struct net_device *dev, int idx); diff --git a/include/net/page_pool/types.h b/include/net/page_pool/types.h index 1509a536cb85..be74e4aec7b5 100644 --- a/include/net/page_pool/types.h +++ b/include/net/page_pool/types.h @@ -161,6 +161,7 @@ struct memory_provider_ops; struct pp_memory_provider_params { void *mp_priv; const struct memory_provider_ops *mp_ops; + u32 rx_buf_len; }; struct page_pool { diff --git a/net/core/netdev_rx_queue.c b/net/core/netdev_rx_queue.c index a0083f176a9c..09d6f97e910e 100644 --- a/net/core/netdev_rx_queue.c +++ b/net/core/netdev_rx_queue.c @@ -29,6 +29,10 @@ int netdev_rx_queue_restart(struct net_device *dev, unsigned int rxq_idx) !qops->ndo_queue_mem_alloc || !qops->ndo_queue_start) return -EOPNOTSUPP; + if (!(qops->supported_params & NDO_QUEUE_RX_BUF_SIZE) && + rxq->mp_params.rx_buf_len) + return -EOPNOTSUPP; + netdev_assert_locked(dev); new_mem = kvzalloc(qops->ndo_queue_mem_size, GFP_KERNEL); -- 2.49.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id gIUOFMZJ7mhXdxYAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 13:01:58 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 13:01:58 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8ef8-00000006uYQ-0Aju for hi@josie.lol; Tue, 14 Oct 2025 13:01:58 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C5CB23E4D80 for ; Tue, 14 Oct 2025 13:00:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B433A3148C2; Tue, 14 Oct 2025 13:00:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DwMl9ymu" X-Original-To: io-uring@vger.kernel.org Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5A62313E05 for ; Tue, 14 Oct 2025 13:00:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760446835; cv=none; b=VtPzqewkRLGS56DcanqOYKC5Svf/SpNgA3ruh14/GysxI7T4r+lcld+1Wo6XhzhXpYNuLyhv3E7fjA81Q4cAU3JYu80xKiHyKzU5iOBX1Dzuo6ij4f6LBoJs0ldj612ksq6cO4iMcFcBp4YGP+6MSQfDtt+aP56DsWYDZGruaGo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760446835; c=relaxed/simple; bh=8sl8zh/edgEOL187hvVRKslTd9Ju8bi2edrvqaXpJ6g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jBs+HcC9PRw4IA/dUoOz5rIuI5R1SloaS/Ij5ojr4jTX2E3iJnVbuclwwuPsVVW/Tr11gmhnx8AR4xLzPGIeMFqp/vt2ORdIsowLFdeq7OiHfAnBDrde8EeDsTOdEETmpcNDFIIz9kTF5dz0T0WsHAIMg0uOfV8ih4YEjnVd04M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DwMl9ymu; arc=none smtp.client-ip=209.85.221.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-426ed6f4db5so467451f8f.0 for ; Tue, 14 Oct 2025 06:00:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760446832; x=1761051632; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4eHv7iWS5Rns6GMFeZ+EPNWQuD+MpI0tmNw4Ue2Rubw=; b=DwMl9ymuaASIc2CqbtCQf1Q0NTrmkTfrESnUsQYjUkvV0ApahXP6xW0E3QPOnporiB 0PzYsKi+aSTzgtqgkViD//LVF5kcoRy79xtjDQtem0iW31PWu8X4j3EX4bZGQS/X0t6v ShL0duq0RxfW7nnAt1InePAj9lJ624pP5V6KOL0KCVaL2rD9Sltea1c7IYiGOB4uHi4V iqDVPpFCYFaZcqFlIVlFwngwdvZ5FDZJQb75DT9tTTuRxqQOlkL+V91CqKE0wUPFeAPy eQ72Miuckzpc/GWI957KVCx6ESACBSlevvFz1LagIDXRt1/dAbbRufmAkBFIGE9dayfn YSug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760446832; x=1761051632; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4eHv7iWS5Rns6GMFeZ+EPNWQuD+MpI0tmNw4Ue2Rubw=; b=mVdDD4ya973r+opsak7ZSb+ufJ520LhUbF+vLDTiWXeYqUSQKwy2fCSBnaamu8+iqS r2YYBFuL6V5zUKtH6WTyPJJN34mvApalbyYwfY8bjiVs/THIFIo13XyqyZeqUiqDNDmf FmxdNep15me4A0sdi1mQvZeQWZDbrG5AyGTq8EzmQae4up6qSuRLlSR7HGfRZyBmW714 7dnAUlosDwMqN/KL92ToB+PzPg0n4fUu+MIvlpcYPAWV+tOzG/WMb868ETvi5lEmP37s 3xk2PEXgBrBScqx8Cjrzv+KywW+P55XNhidWkkoFQaMysmbIRYF7wDzAgbfAxhijjeXy UeFQ== X-Forwarded-Encrypted: i=1; AJvYcCUsM+XJccCFFVgANj4lOVdyNGyqGIXxP1Wa46Ns661PbYbh2dzw+O6Q5r9HW+v3a+xg4o53YlNPpg==@vger.kernel.org X-Gm-Message-State: AOJu0Yy9ErmYuCiv8iNn+dWWGzaIaUZ0qEAZ28BYQuBVK15G314ofakL 1/tEiIdtGDwauYH82eQPp2dZuwPGT7/kXdnpmxDVJK1mMsUdn3GiHzQp X-Gm-Gg: ASbGnctH24hNfl2rAMVonCz0brzPRu5/iKbWqViYgu4lPmMxvVhfD64dz0H9M+m/una m33yi1HUkxrwRMvRU2T2inhJl4pPxdFdZ/OzGrZlLHXdWa9a1xmOtqKp0ekdMZg2nMYU2RTDbiy s9aLpRfXramWza2Gp2X9c9GeHX5P3td3IanioDHkJ4y//1Sk5R/BvSJK9YmO8B8p30iP6yPgzPz enJREcjqFcCIXaXquwprcMUXxfpFxRXts3v9sV/ltidJKeh+SfNs6t2Civ3QKNk1Dea53E8BNGF QMs4A+rLM6J6+vsqFSsYpusbZWmKBOHc5dsd4ESQDajl7bJa1iRXEet3hrNlOW64gS7EYfCD1nO HqkDTo2O4kTOv4F6mRmwdYQeIHLag0IWjvCI= X-Google-Smtp-Source: AGHT+IHTVOrXrZfK+kAqvvmeegQqbXJ5u1kSQeQq4d6GAFTvHJqKybjw0WNnBMaqSNBLp4I965jdvA== X-Received: by 2002:a5d:5005:0:b0:425:8334:9a9d with SMTP id ffacd0b85a97d-42583349adamr13032753f8f.1.1760446831885; Tue, 14 Oct 2025 06:00:31 -0700 (PDT) Received: from 127.com ([2620:10d:c092:600::1:7ec0]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-426ce582b39sm23296494f8f.15.2025.10.14.06.00.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Oct 2025 06:00:30 -0700 (PDT) From: Pavel Begunkov To: netdev@vger.kernel.org, io-uring@vger.kernel.org Cc: Michael Chan , Pavan Chebbi , Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , Simon Horman , Ilias Apalodimas , Mina Almasry , Pavel Begunkov , Willem de Bruijn , Dragos Tatulea , Saeed Mahameed , Tariq Toukan , Mark Bloch , David Wei , linux-kernel@vger.kernel.org Subject: [PATCH net-next v5 2/6] net: memzero mp params when closing a queue Date: Tue, 14 Oct 2025 14:01:22 +0100 Message-ID: <80f18e7ee9bd50514d7dca31b5f28c5b0b27e3a5.1760440268.git.asml.silence@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [asml.silence[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 Instead of resetting memory provider parameters one by one in __net_mp_{open,close}_rxq, memzero the entire structure. It'll be used to extend the structure. Signed-off-by: Pavel Begunkov --- net/core/netdev_rx_queue.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/net/core/netdev_rx_queue.c b/net/core/netdev_rx_queue.c index c7d9341b7630..a0083f176a9c 100644 --- a/net/core/netdev_rx_queue.c +++ b/net/core/netdev_rx_queue.c @@ -139,10 +139,9 @@ int __net_mp_open_rxq(struct net_device *dev, unsigned int rxq_idx, rxq->mp_params = *p; ret = netdev_rx_queue_restart(dev, rxq_idx); - if (ret) { - rxq->mp_params.mp_ops = NULL; - rxq->mp_params.mp_priv = NULL; - } + if (ret) + memset(&rxq->mp_params, 0, sizeof(rxq->mp_params)); + return ret; } @@ -179,8 +178,7 @@ void __net_mp_close_rxq(struct net_device *dev, unsigned int ifq_idx, rxq->mp_params.mp_priv != old_p->mp_priv)) return; - rxq->mp_params.mp_ops = NULL; - rxq->mp_params.mp_priv = NULL; + memset(&rxq->mp_params, 0, sizeof(rxq->mp_params)); err = netdev_rx_queue_restart(dev, ifq_idx); WARN_ON(err && err != -ENETDOWN); } -- 2.49.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id ePrYE6dJ7mjY0BIAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 13:01:27 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 13:01:27 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8eed-00000006sbV-0Cwd for hi@josie.lol; Tue, 14 Oct 2025 13:01:27 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E9EDE3B3575 for ; Tue, 14 Oct 2025 13:00:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3C5B5313E2B; Tue, 14 Oct 2025 13:00:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dLEw4chP" X-Original-To: io-uring@vger.kernel.org Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59E372045AD for ; Tue, 14 Oct 2025 13:00:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760446834; cv=none; b=RgWIb3CdcvpwnAkcyg+l31QfuxrUPaGqIw+5vpdy7bQ2m+6Mq8+ROEiX09xJutpBdVbk7QvJmfcfQabDNaX21pePcZOEVYVbWQEYvusLkvogPjRvTrMkVCQ2YxkZAivdBe+Nr1f9NcNFxFr7yW40iekoBz2FJc+yK39W2d1bNMA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760446834; c=relaxed/simple; bh=7sj1EbpAJnpeoVxMcwuWL5zaTTOuVyXNUSbxilQjCno=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jBqTkMjk0I5LS6xdhQbCQfkFi4LwQ+Z3kQhN1m5s1UR05xeLmcCsPC9YXWqvb+bw8pzIB9t/PDxEskSxixNEUe+RZffvAD1ZJ6uyjvZAc70ApGz2DD/TuNWV9NPdI0Zod/nzePIOrves1dKi8SOx/j8H1ujwgi7YjU/PsQ7xdd4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dLEw4chP; arc=none smtp.client-ip=209.85.221.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-3f2ae6fadb4so6012003f8f.1 for ; Tue, 14 Oct 2025 06:00:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760446831; x=1761051631; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HqDy67Vpwu3GYg1tc86jhK5pz5tDZBEzHj59MW+Ighs=; b=dLEw4chPZtppEZHUwVBJMxSn8+VNCb8PF2T4mBHtWpSH0ZxJWIoXGWsfYniBIkQnN5 SDHwk8ONNfEsmbHflSE0iq02HbZ6ylK/f07X5Y/z628Q0CuokMbMkrdKYehYPS7NZQJw 6msR0rPwg2z/qgJOxuNn2dbxItqvO2B+BjtxkZXUSJpno72quEprPQlHYu1Xg3tm3zyV HABvlAS29aztIafsDzmgo2oIhqpUc2tjy8OMLtwQfzaqDJG0+wtStKqqaJi84lvlBXp5 wAj6f9esI/jOzR+srFWsL/f9yGoYPz/c6wQxk5q7UKw3Z6xg+2Sf3CFpuE49KHx1p8DM sJPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760446831; x=1761051631; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HqDy67Vpwu3GYg1tc86jhK5pz5tDZBEzHj59MW+Ighs=; b=o11FuTAKuiJzk+HFeJRlsj3oWWd8SVzWqwuimYJ8NeI9OspVFmaQrT57woxhnhZ0mJ qHqYtwxzzubP6u3zO6hzsKwP63Es1IPFlCmSUyYc/uuSaVF+sZAnvMAfpTOu3G1wcyL4 pF7Fjs+XMSckdCzHlTzXUqvi+1ol7bpjvYoPKKf/Lw9M7UQgUvg69KHOOX+sbwkd0JRA aJKtLlJ61vKccIxbRb6hRx/0rdI2MG3Wi1jefD55V+Kjmap9cEXcfl89chwDb7MsSOuF HTprF5ioXvACDRdVYUygrvbY/Tnm2UkG2VRknYzYxJmAv0mWdw3luue7WnYloB5WY2hT zilw== X-Forwarded-Encrypted: i=1; AJvYcCXUa73y54Sv14qu4E/vD579IUzQDu3Qtz8wa3SsaF71VzkvD0jA3yhKfs7n8wMpZjcYUIxjEZT7cA==@vger.kernel.org X-Gm-Message-State: AOJu0YyHnA4LoLBXMTOIRcI9YFI4+ZIIt1cvzb0zHeLdprlH8zsFFymy VlfowKvGBHaaRkGy9UPamwACQ04p+9SZv6NBOaCfH+uFh82oXaN0jeSz X-Gm-Gg: ASbGnctxtu4S0tz/lzavO0+nkGvEwgBs/vsRSzk8qC81xgFnxxgQUgoswAKqr/owJne GU6H52yTBrHK+5VumzpLxcax4ID+Hkm3plMrwU026KKEJUufyMTSImQWeWwcVazne9rmuYcwBeO 0kAZA2m79ToitQGlFphWI7EJoM9ZEDoF09QOz7djlTSL679ml6yvf0PAKSBauyGjK8zzR8zfU/9 Pjfu9T9B1cEM3OQTRCL4yV7wYzIEG98VxUctHQJnZDL75p2QPJoIass/kR/ekqjq/osIRXQSOcD yo07k4Sj8NrcSrUbiI7BVko2rlFXtiDuSYsVzFIuEH5Nl/VU5V7KGKjfcJ00BRSTS03dasfkNuK myOe+cAlbIFN8ecNu1W2d3X6hxPp9MjIR8Gc= X-Google-Smtp-Source: AGHT+IEU0HIsqzFENU6qye7d3i2PLdW3lTydX5soY1R/d6XQCyDdPxuPIE/paJs9wGzyPRz9zSdyOA== X-Received: by 2002:a05:6000:2485:b0:3e9:ee54:af71 with SMTP id ffacd0b85a97d-42666ac48afmr16043000f8f.12.1760446830036; Tue, 14 Oct 2025 06:00:30 -0700 (PDT) Received: from 127.com ([2620:10d:c092:600::1:7ec0]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-426ce582b39sm23296494f8f.15.2025.10.14.06.00.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Oct 2025 06:00:29 -0700 (PDT) From: Pavel Begunkov To: netdev@vger.kernel.org, io-uring@vger.kernel.org Cc: Michael Chan , Pavan Chebbi , Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , Simon Horman , Ilias Apalodimas , Mina Almasry , Pavel Begunkov , Willem de Bruijn , Dragos Tatulea , Saeed Mahameed , Tariq Toukan , Mark Bloch , David Wei , linux-kernel@vger.kernel.org, Stanislav Fomichev Subject: [PATCH net-next v5 1/6] net: page_pool: sanitise allocation order Date: Tue, 14 Oct 2025 14:01:21 +0100 Message-ID: <126a5fbb2bfdfb1c3aa9421c0a8e22d8cc0af602.1760440268.git.asml.silence@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [asml.silence[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 We're going to give more control over rx buffer sizes to user space, and since we can't always rely on driver validation, let's sanitise it in page_pool_init() as well. Note that we only need to reject over MAX_PAGE_ORDER allocations for normal page pools, as current memory providers don't need to use the buddy allocator and must check the order on init.i Suggested-by: Stanislav Fomichev Reviewed-by: Mina Almasry Signed-off-by: Pavel Begunkov --- net/core/page_pool.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/core/page_pool.c b/net/core/page_pool.c index 1a5edec485f1..635c77e8050b 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -301,6 +301,9 @@ static int page_pool_init(struct page_pool *pool, } static_branch_inc(&page_pool_mem_providers); + } else if (pool->p.order > MAX_PAGE_ORDER) { + err = -EINVAL; + goto free_ptr_ring; } return 0; -- 2.49.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id mN3xOINJ7mjY0BIAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 13:00:51 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 13:00:51 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8ee3-00000006qkc-2FNw for hi@josie.lol; Tue, 14 Oct 2025 13:00:51 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 93DA83A38C5 for ; Tue, 14 Oct 2025 13:00:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 61F6B2116F4; Tue, 14 Oct 2025 13:00:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="epqoEHI6" X-Original-To: io-uring@vger.kernel.org Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 823551E260C for ; Tue, 14 Oct 2025 13:00:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760446832; cv=none; b=dg9JBafHU0RL8CQyDSRjbCzM7RmGW86572ogwCfPbiH1crCXAHWaBQsVyQXWesG3SlVRsiJP1pirinDRL8LzwPiDFgXmkvFmvNaKRc1na9wm8F3rKXnREWhU8I0mnGAYOkUazDkpo/7FDK///C3prg+nsvJdER0jjZyKyIXgMJ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760446832; c=relaxed/simple; bh=yC16Cf9FMJscSBzx0tg70+ZAO1nULgzq46Rq7RWDwRk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ZJqqJWHmk6+IR1zavmn96/JfNhuNbc/xmGUaf7ZgVr6lGTg3UlpZ1+kWLrMPyL2bYCU/wv5cDEhN+lRnLaN2M1XwD8uMEyqzpZdiYaa4iWumO2si6+MRGPPmkt/NP0i5jRzmAO98gij8Jhx02wkg5ODtWasMPLB0RpoSiu9Z058= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=epqoEHI6; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-3f0308469a4so2906109f8f.0 for ; Tue, 14 Oct 2025 06:00:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760446829; x=1761051629; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=drtmDZAOmuCnQVy+ATNHRyErjp9xi9I5nuXjriiDL/I=; b=epqoEHI6UasjISOjXZQ5jSX+wK5NAIYmDIcr8EBc1M4BHt4ZYNokrEpVkU1XrNBayS PdsasiSjsXFQ1rv7m9urjGR+eAN9YCah8FJTySyNgyUQr/+3Q8A/qH372S00H2leXvX0 sllY2k9gE8Y73a+1RpJGW0UtpkY0/uo3Cl/gAxVGxoQYnd+6BzImW/OFeT4JkcatAIwa IL97z2hCxTbHiJl/VBCVudgqBzK+F3+q3kMBwsYvDzgiuWtYPXylJ2V3TC4g3JQ48slv 6Hb/mK3Zk+FkEgTc/J7XO5Qo5IRM8sxCxZVnY0tleD1sVjOM58AkBewfMiM5gCYwJToE OJlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760446829; x=1761051629; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=drtmDZAOmuCnQVy+ATNHRyErjp9xi9I5nuXjriiDL/I=; b=QRzNw9xf3/irvGXgyIuGhn4RHqcNxVrjIFvXoEbh6ZX/ZdG3kQkmWea0VWlntEdKft YzB/OuIyEX7RHqCO8C3Q0PjFy89Q5XbeYjsmlvWTifGq6x6ynBWrAE2VWCD66AQ7kj62 p4OKFym2WEzdG1CD//mAJs05UWLFXLOVoGhiDpUafogXnGKYwAfliS7HJ1c9jLXDR/Ew ul+9q3xouK7Q3arhUDx71ANNCT5bBSBR1UZu44NTiLC6RKIlySLEMiH24rJCC4O3uPKh fzYmm7lc0k3hYQujtVbxbt0Ql+F3siDiIzpxmDOJBYBqT51VnPfp1Nd7wTa+tCKDQDH3 /bXg== X-Forwarded-Encrypted: i=1; AJvYcCVN7IqjBmuWWLl7QGeV7yVKF1uABM/l+xoiWtCroftE2vr2lW5fBEcFeBDbBaSvfvaICiTe6ksh2A==@vger.kernel.org X-Gm-Message-State: AOJu0YwBQbOEWDIbkQVd6tAkVBQ/57I3dgPzS0ozbOLaU+24n8cuhr3f S2ExJ7+WJs/VwrkPubAbASR1Tm1qHiEdPB/TdN1xS9W3bKqQ11hcA6iS X-Gm-Gg: ASbGnct39jo6qlWdrgJpWr/IwxVNQHTsUXmR1iNcWH4xtzBWKWGwUoFxs2QvKZJG17O Z7XHCUxW8SyowoK+At8wBD02dUBdq8vUmiBsblvMxiIn2WJPQ6TSBxQlqKXVYcFkFOCp+41e++r NWSSTJ+aQ7/LK7Dx90Jl4E/PI0ZgPf82UEQApvfjEumxW0HW2zwfrFc7PVFTUkomKe9dgm78URw C69Sjx56/BqbnCb7n/uwZnBmNnYJbQIQLOkQTbN43xwdomeLzK9ywR4PGKANo6Cbfyv+kwXoJk9 h0pivION0NPQpnqlIEqNwAf7jV8632Rf9RDbPB1hzl5sqBP290+G3kNf46g9Pzdid1ru1Vnge+1 vsFr2p5O/K398e5UcixqRzpHzWPEyJSLZZsg= X-Google-Smtp-Source: AGHT+IGQ0Gd56K7JwPfQZZ3tAk3u4pF1GdKS8UOWl4Tdgb55qv85ApxtPpM/O9AT16A2P/7TiGsfKw== X-Received: by 2002:a05:6000:26d0:b0:425:8bf9:557d with SMTP id ffacd0b85a97d-4266e8dd3c2mr17404314f8f.44.1760446823887; Tue, 14 Oct 2025 06:00:23 -0700 (PDT) Received: from 127.com ([2620:10d:c092:600::1:7ec0]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-426ce582b39sm23296494f8f.15.2025.10.14.06.00.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Oct 2025 06:00:22 -0700 (PDT) From: Pavel Begunkov To: netdev@vger.kernel.org, io-uring@vger.kernel.org Cc: Michael Chan , Pavan Chebbi , Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , Simon Horman , Ilias Apalodimas , Mina Almasry , Pavel Begunkov , Willem de Bruijn , Dragos Tatulea , Saeed Mahameed , Tariq Toukan , Mark Bloch , David Wei , linux-kernel@vger.kernel.org Subject: [PATCH net-next v5 00/24][pull request] Add support for providers with large rx buffer Date: Tue, 14 Oct 2025 14:01:20 +0100 Message-ID: X-Mailer: git-send-email 2.49.0 Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [asml.silence[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: -18 Many modern network cards support configurable rx buffer lengths larger than typically used PAGE_SIZE. When paired with hw-gro larger rx buffer sizes can drastically reduce the number of buffers traversing the stack and save a lot of processing time. Another benefit for memory providers like zcrx is that the userspace will be getting larger contiguous chunks as well. This series adds net infrastructure for memory providers configuring the size and implements it for bnxt. It'll be used by io_uring/zcrx, which is intentionally separated to simplify merging. You can find a branch that includes zcrx changes at [1] and an example liburing program at [3]. It's an opt-in feature for drivers, they should advertise support for the parameter in the qops and must check if the hardware supports the given size. It's limited to memory providers as it drastically simplifies the series comparing with previous revisions and detangles it from ethtool api discussions. The idea was first floated around by Saeed during netdev conf 2024. The series also borrows some patches from [2]. Benchmarks with zcrx [3] show up to ~30% improvement in CPU util. E.g. comparison for 4K vs 32K buffers using a 200Gbit NIC, napi and userspace pinned to the same CPU: packets=23987040 (MB=2745098), rps=199559 (MB/s=22837) CPU %usr %nice %sys %iowait %irq %soft %idle 0 1.53 0.00 27.78 2.72 1.31 66.45 0.22 packets=24078368 (MB=2755550), rps=200319 (MB/s=22924) CPU %usr %nice %sys %iowait %irq %soft %idle 0 0.69 0.00 8.26 31.65 1.83 57.00 0.57 netdev + zcrx changes: [1] https://github.com/isilence/linux.git zcrx/large-buffers-v5 Per queue configuration series: [2] https://lore.kernel.org/all/20250421222827.283737-1-kuba@kernel.org/ Liburing example: [3] https://github.com/isilence/liburing.git zcrx/rx-buf-len --- The following changes since commit 3a8660878839faadb4f1a6dd72c3179c1df56787: Linux 6.18-rc1 (2025-10-12 13:42:36 -0700) are available in the Git repository at: https://github.com/isilence/linux.git tags/net-for-6.19-queue-rx-buf-len-v5 for you to fetch changes up to f389276330412ec4305fb423944261e78490f06a: eth: bnxt: allow providers to set rx buf size (2025-10-14 00:11:59 +0100) v5: Remove all unnecessary bits like configuration via netlink, and multi-stage queue configuration. v4: https://lore.kernel.org/all/cover.1760364551.git.asml.silence@gmail.com/ - Update fbnic qops - Propagate max buf len for hns3 - Use configured buf size in __bnxt_alloc_rx_netmem - Minor stylistic changes v3: https://lore.kernel.org/all/cover.1755499375.git.asml.silence@gmail.com/ - Rebased, excluded zcrx specific patches - Set agg_size_fac to 1 on warning v2: https://lore.kernel.org/all/cover.1754657711.git.asml.silence@gmail.com/ - Add MAX_PAGE_ORDER check on pp init - Applied comments rewording - Adjust pp.max_len based on order - Patch up mlx5 queue callbacks after rebase - Minor ->queue_mgmt_ops refactoring - Rebased to account for both fill level and agg_size_fac - Pass providers buf length in struct pp_memory_provider_params and apply it in __netdev_queue_confi(). - Use ->supported_ring_params to validate drivers support of set qcfg parameters. Jakub Kicinski (1): eth: bnxt: adjust the fill level of agg queues with larger buffers Pavel Begunkov (5): net: page_pool: sanitise allocation order net: memzero mp params when closing a queue net: let pp memory provider to specify rx buf len eth: bnxt: store rx buffer size per queue eth: bnxt: allow providers to set rx buf size drivers/net/ethernet/broadcom/bnxt/bnxt.c | 118 ++++++++++++++---- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 2 + drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 6 +- drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.h | 2 +- include/net/netdev_queues.h | 9 ++ include/net/page_pool/types.h | 1 + net/core/netdev_rx_queue.c | 14 ++- net/core/page_pool.c | 3 + 8 files changed, 118 insertions(+), 37 deletions(-) -- 2.49.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id iKrAAipP7mi0ABsAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 13:24:58 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 13:24:58 +0000 Received: from ams.mirrors.kernel.org ([213.196.21.55]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8f1N-00000007eYP-2eSC for hi@josie.lol; Tue, 14 Oct 2025 13:24:58 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.mirrors.kernel.org (Postfix) with ESMTPS id 84DED34C75F for ; Tue, 14 Oct 2025 13:24:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E82ED304BC5; Tue, 14 Oct 2025 13:24:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="aVBZi4vM" X-Original-To: stable@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (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 D9C5E76026 for ; Tue, 14 Oct 2025 13:24:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760448253; cv=none; b=EJ78DrE4XLDAdOqXOMH8B319XvvMnRjGvoHRxG5I8kLg2CnSzw56FB4YQZrfqcUZk6LuGR8PZQGBdbvmf5S8DdGkkLw40KS5aTi7SYeMZ7Am75I2m2NvSEaCI3s9THwX0TeylYBKZ+z4/NPKtEA5TruBXopbD6UDRqso+hjJsTU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760448253; c=relaxed/simple; bh=opNPiQ86iTleJgV+aGACixQJGM2opT7eh2amXNqX9Kg=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=EcgSvFSOEx3iwu5w0eDlytgtWpHDODnFpiaLU7RLH+eqEtIxS5BgfZbeyBwfHeVD31CZ2ftujAJAHOUkUUeMXSVO2GkMD9d7V2XYKAbJiq0JnI/DBKLEjFsNoN1JExY8EQr5XbFokVJPOkQqr/Q9nXXjvf5p3DpgRWF+oKlDpGE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=aVBZi4vM; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1760448252; x=1791984252; h=date:from:to:cc:subject:message-id:mime-version: in-reply-to; bh=opNPiQ86iTleJgV+aGACixQJGM2opT7eh2amXNqX9Kg=; b=aVBZi4vMKk/Kz4KxxTdB0ucPAunsebQ6UOkekP70F6K22vTV9+rbcoF/ Y8Nyv78jdfg1wO3CiQJntIvFBjusEYZxLDLC6o0IJRyNhFMarCVTfE02y lYZ3091jHt8teSRtOXysbr2f9i4ZsqP2tmrbdoZdoca8mA/ZKcyWUVn0o dfrUKWfm3FC/K6u18+rAR7HN0VRTY7ak80LBH+DgJ7ZUCxUD2zNI1wJif BZE1GF+mh1sVb+37Uy5r1tZ3a0+X2+NMMWT6K3w8d0awv5UQhfV28ovT/ pkXR0P8vXXYZDOaRoUguvMpGBX6ahmRcRi5hcYMpGK3dTHzd8ss2MXIAa A==; X-CSE-ConnectionGUID: tjpZjvZDQgOIHvXRlJgdqg== X-CSE-MsgGUID: v1Uv37AAQ+S81w41JasN/A== X-IronPort-AV: E=McAfee;i="6800,10657,11531"; a="66432128" X-IronPort-AV: E=Sophos;i="6.17,312,1747724400"; d="scan'208";a="66432128" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2025 06:24:11 -0700 X-CSE-ConnectionGUID: HTqzEosuT1yNh+5t7scU9w== X-CSE-MsgGUID: ayYEJElzRP6tQyPDfPrHFQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,228,1754982000"; d="scan'208";a="181692135" Received: from lkp-server02.sh.intel.com (HELO 66d7546c76b2) ([10.239.97.151]) by orviesa007.jf.intel.com with ESMTP; 14 Oct 2025 06:24:11 -0700 Received: from kbuild by 66d7546c76b2 with local (Exim 4.96) (envelope-from ) id 1v8f0a-0002pT-0u; Tue, 14 Oct 2025 13:24:08 +0000 Date: Tue, 14 Oct 2025 21:24:01 +0800 From: kernel test robot To: Jacopo Mondi Cc: stable@vger.kernel.org, oe-kbuild-all@lists.linux.dev Subject: Re: [PATCH for v6.18 v5 2/2] media: ivtv: Fix invalid access to file * Message-ID: Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251014-cx18-v4l2-fh-v5-2-e09e64bc4725@ideasonboard.com> X-DKIM: signer='intel.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-DKIM: signer='@intel.com' status='pass' reason='' X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: intel.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [213.196.21.55 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: 4 Hi, Thanks for your patch. FYI: kernel test robot notices the stable kernel rule is not satisfied. The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html#option-3 Rule: The upstream commit ID must be specified with a separate line above the commit text. Subject: [PATCH for v6.18 v5 2/2] media: ivtv: Fix invalid access to file * Link: https://lore.kernel.org/stable/20251014-cx18-v4l2-fh-v5-2-e09e64bc4725%40ideasonboard.com Please ignore this mail if the patch is not relevant for upstream. -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id QMNIJzZP7mhPjxoAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 13:25:10 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 13:25:10 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8f1a-00000007f1p-0dk3 for hi@josie.lol; Tue, 14 Oct 2025 13:25:10 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6EE2E3AD7C4 for ; Tue, 14 Oct 2025 13:21:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F3274315D21; Tue, 14 Oct 2025 13:19:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="EKKBqfE7" X-Original-To: stable@vger.kernel.org Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 DE36B315767; Tue, 14 Oct 2025 13:19:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760447993; cv=none; b=VbODWn/7XWSWZuWmOT8gVDv7vCEfJ1I2kauyMGLbdelUOIRsY7iCi9uHIImTUYGmgxKIWwEcP4WbvIQG9sGywks91u6ArUWCHl2GYIUcUtrRLioKQoN5ry+Vd17/QLEh4z4hiN77IGD0Q3Rdz8yDrSH5dsps5LzLviVi+5x7yEk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760447993; c=relaxed/simple; bh=4iNlYNbWJN2E2na5bqAS5fVIMurLHwzbEOZDnRERU14=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PNjfHQzeP+pUtfWxuQR7hzcC4o2v07FWRPDMF+NX6+/PNTDBwjM3iIFe2jtSNx/uwkHF8ozf9l46GhFsXs2QSKNtKZsfx8yDsxPVdKVkfr+psRBmcjLF2TLrRUkoliOMv2Xk2awEfyXQdpXegQ/O6tmr1gh9OWrNoK6d5l8zTdI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=EKKBqfE7; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Received: from [192.168.1.182] (93-46-82-201.ip106.fastwebnet.it [93.46.82.201]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4E3E8E70; Tue, 14 Oct 2025 15:18:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1760447888; bh=4iNlYNbWJN2E2na5bqAS5fVIMurLHwzbEOZDnRERU14=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=EKKBqfE7Rnb0jL5Yp7i1B2eKzMbIagOxkKV187bHYYLhILI0sBEsLvdAywFY4NDXL UJEAOC4rF1uXcrwlX2r5RaUQlZ0n9DApC6yxr85f4hxqdlv1XHTH7jA1ghMEBeho+R DrkZVB6lYpIL8h2Y0mT144ME3jHVKjCyUnlOZE/c= From: Jacopo Mondi Date: Tue, 14 Oct 2025 15:19:34 +0200 Subject: [PATCH for v6.18 v5 2/2] media: ivtv: Fix invalid access to file * Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20251014-cx18-v4l2-fh-v5-2-e09e64bc4725@ideasonboard.com> References: <20251014-cx18-v4l2-fh-v5-0-e09e64bc4725@ideasonboard.com> In-Reply-To: <20251014-cx18-v4l2-fh-v5-0-e09e64bc4725@ideasonboard.com> To: Andy Walls , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart Cc: Dan Carpenter , stable@vger.kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=6250; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=4iNlYNbWJN2E2na5bqAS5fVIMurLHwzbEOZDnRERU14=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBo7k3xRJmAePjC0rQxIUzcA0E48rke95GwMQ9qI K+WMokvn4eJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaO5N8QAKCRByNAaPFqFW PLIUD/0SyVT0AMZABE02uM/x5MoBmxeX6zU6pVNZ2YKd8Qx0spstAXHrTVUi2lKzemYtSa3W4lO z3htjTjG8xmaD3xjjI4fsPze1SSZWkHcTLpf6oDJsGBBgSwRXwBlFWr32jV2x177fRNaMk8kJth 7gm+q2j69Ie19ISczTA7YFZeqlq3pgCkB6SO/8Qtz316COEwrsSwPXl/bQIhZxD3YUNBXNM+2ut WR8QxxF20djdSwk9OHBcvdm0siFwMBfjBDCie3/IeF1EGZ6Ha6igMRpdAALESE3AwP/VJzTT49j yawBnHTM2n966y5aZla08JRj4i8+zHlJES5g5QmfCbzLDirnzAHy53efFEflFjNIJowspPlY2M4 7r98a32eUpaFQ11r6BovL0LP7Cab8kJPXXAZ17fTkXmZeS9FBv4/6zUKk+FMLeN9RzapfzTLn8p GqJYSYw9N1SpqRtFoSCIlgqUozB3xYI0QbMnX6yTwHBOStB1XluFgKwUpbKwTiG+fzidri4COR4 5XlbDiWLeRRu8x1uS7PfnQXXeDRrorRlXRoIBJL6RBX6fusQhyt2XQF3GlG1SupanyP28we8eXB oGMfcAAPVVOjz/uHJOGiCqTVv+BsG6zHyt8lo8lSbhmTzdsMqmi/RInXVBvqVFg1lgc7eQ4UtV9 9g/zP1bgGXYPdIw== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B X-DKIM: signer='ideasonboard.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: ideasonboard.com] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: -18 Since commit 9ba9d11544f9 ("media: ivtv: Access v4l2_fh from file") all ioctl handlers have been ported to operate on the file * first function argument. The ivtv DVB layer calls ivtv_init_on_first_open() when the driver needs to start streaming. This function calls the s_input() and s_frequency() ioctl handlers directly, but being called from the driver context, it doesn't have a valid file * to pass them. This causes the ioctl handlers to deference an invalid pointer. Fix this by moving the implementation of those ioctls to two helper functions. The ivtv_do_s_input() helper accepts a struct ivtv * as first argument, which is easily accessible in ivtv_init_on_first_open() as well as from the file * argument of the ioctl handler. The ivtv_s_frequency() takes an ivtv_stream * instead. The stream * can safely be accessed in ivtv_init_on_first_open() where it is hard-coded to the IVTV_ENC_STREAM_TYPE_MPG stream type, as well as from the ioctl handler as a valid stream type is associated to each open file handle depending on which video device node has been opened in the ivtv_open() file operation. The bug has been reported by Smatch. Reported-by: Dan Carpenter Closes: https://lore.kernel.org/all/aKL4OMWsESUdX8KQ@stanley.mountain/ Fixes: 9ba9d11544f9 ("media: ivtv: Access v4l2_fh from file") Cc: stable@vger.kernel.org Reviewed-by: Laurent Pinchart Tested-by: Hans Verkuil Signed-off-by: Jacopo Mondi --- drivers/media/pci/ivtv/ivtv-driver.c | 11 ++++------- drivers/media/pci/ivtv/ivtv-ioctl.c | 22 +++++++++++++++++----- drivers/media/pci/ivtv/ivtv-ioctl.h | 6 ++++-- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/drivers/media/pci/ivtv/ivtv-driver.c b/drivers/media/pci/ivtv/ivtv-driver.c index 72a8f76a41f45091fdd4fe0335ecb828d555eb9c..459eb6cc370cc078a464d4f40659772ed650e128 100644 --- a/drivers/media/pci/ivtv/ivtv-driver.c +++ b/drivers/media/pci/ivtv/ivtv-driver.c @@ -1247,15 +1247,12 @@ static int ivtv_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) int ivtv_init_on_first_open(struct ivtv *itv) { - struct v4l2_frequency vf; /* Needed to call ioctls later */ - struct ivtv_open_id fh; + struct ivtv_stream *s = &itv->streams[IVTV_ENC_STREAM_TYPE_MPG]; + struct v4l2_frequency vf; int fw_retry_count = 3; int video_input; - fh.itv = itv; - fh.type = IVTV_ENC_STREAM_TYPE_MPG; - if (test_bit(IVTV_F_I_FAILED, &itv->i_flags)) return -ENXIO; @@ -1297,13 +1294,13 @@ int ivtv_init_on_first_open(struct ivtv *itv) video_input = itv->active_input; itv->active_input++; /* Force update of input */ - ivtv_s_input(NULL, &fh, video_input); + ivtv_do_s_input(itv, video_input); /* Let the VIDIOC_S_STD ioctl do all the work, keeps the code in one place. */ itv->std++; /* Force full standard initialization */ itv->std_out = itv->std; - ivtv_s_frequency(NULL, &fh, &vf); + ivtv_do_s_frequency(s, &vf); if (itv->card->v4l2_capabilities & V4L2_CAP_VIDEO_OUTPUT) { /* Turn on the TV-out: ivtv_init_mpeg_decoder() initializes diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c b/drivers/media/pci/ivtv/ivtv-ioctl.c index 84c73bd22f2daf405ba5ef98894b98d40e5c7cf2..8d5ea3aec06f3dcb36ba4f52c9a8d621511d5c10 100644 --- a/drivers/media/pci/ivtv/ivtv-ioctl.c +++ b/drivers/media/pci/ivtv/ivtv-ioctl.c @@ -974,9 +974,8 @@ static int ivtv_g_input(struct file *file, void *fh, unsigned int *i) return 0; } -int ivtv_s_input(struct file *file, void *fh, unsigned int inp) +int ivtv_do_s_input(struct ivtv *itv, unsigned int inp) { - struct ivtv *itv = file2id(file)->itv; v4l2_std_id std; int i; @@ -1017,6 +1016,11 @@ int ivtv_s_input(struct file *file, void *fh, unsigned int inp) return 0; } +static int ivtv_s_input(struct file *file, void *fh, unsigned int inp) +{ + return ivtv_do_s_input(file2id(file)->itv, inp); +} + static int ivtv_g_output(struct file *file, void *fh, unsigned int *i) { struct ivtv *itv = file2id(file)->itv; @@ -1065,10 +1069,9 @@ static int ivtv_g_frequency(struct file *file, void *fh, struct v4l2_frequency * return 0; } -int ivtv_s_frequency(struct file *file, void *fh, const struct v4l2_frequency *vf) +int ivtv_do_s_frequency(struct ivtv_stream *s, const struct v4l2_frequency *vf) { - struct ivtv *itv = file2id(file)->itv; - struct ivtv_stream *s = &itv->streams[file2id(file)->type]; + struct ivtv *itv = s->itv; if (s->vdev.vfl_dir) return -ENOTTY; @@ -1082,6 +1085,15 @@ int ivtv_s_frequency(struct file *file, void *fh, const struct v4l2_frequency *v return 0; } +static int ivtv_s_frequency(struct file *file, void *fh, + const struct v4l2_frequency *vf) +{ + struct ivtv_open_id *id = file2id(file); + struct ivtv *itv = id->itv; + + return ivtv_do_s_frequency(&itv->streams[id->type], vf); +} + static int ivtv_g_std(struct file *file, void *fh, v4l2_std_id *std) { struct ivtv *itv = file2id(file)->itv; diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.h b/drivers/media/pci/ivtv/ivtv-ioctl.h index 7f8c6f43d397f050a8116429db7a9a7accc0336b..96ca7e2ef973f72c4655726a854a5a6ac24be83b 100644 --- a/drivers/media/pci/ivtv/ivtv-ioctl.h +++ b/drivers/media/pci/ivtv/ivtv-ioctl.h @@ -9,6 +9,8 @@ #ifndef IVTV_IOCTL_H #define IVTV_IOCTL_H +struct ivtv; + u16 ivtv_service2vbi(int type); void ivtv_expand_service_set(struct v4l2_sliced_vbi_format *fmt, int is_pal); u16 ivtv_get_service_set(struct v4l2_sliced_vbi_format *fmt); @@ -17,7 +19,7 @@ int ivtv_set_speed(struct ivtv *itv, int speed); void ivtv_set_funcs(struct video_device *vdev); void ivtv_s_std_enc(struct ivtv *itv, v4l2_std_id std); void ivtv_s_std_dec(struct ivtv *itv, v4l2_std_id std); -int ivtv_s_frequency(struct file *file, void *fh, const struct v4l2_frequency *vf); -int ivtv_s_input(struct file *file, void *fh, unsigned int inp); +int ivtv_do_s_frequency(struct ivtv_stream *s, const struct v4l2_frequency *vf); +int ivtv_do_s_input(struct ivtv *itv, unsigned int inp); #endif -- 2.51.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id oJuOHFpO7mi0ABsAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 13:21:30 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 13:21:30 +0000 Received: from ams.mirrors.kernel.org ([213.196.21.55]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8ey1-00000007XDr-3aHi for hi@josie.lol; Tue, 14 Oct 2025 13:21:30 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.mirrors.kernel.org (Postfix) with ESMTPS id 9C406355634 for ; Tue, 14 Oct 2025 13:21:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A67C9314D21; Tue, 14 Oct 2025 13:19:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="rws2QiQ2" X-Original-To: stable@vger.kernel.org Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 6124E31352D; Tue, 14 Oct 2025 13:19:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760447990; cv=none; b=HM3OKEEW0OFWp6vW9CiNv4wJAoLsP7n7yEo9MXh6G7zMdu7iGPXvuMzvIG/GgfcHBaXknZirwEEKaxx+dtviIGN0ICOhjZKYPQjVvu96WXcELqj/D/Zub6kn898Fu0SK+r8EtEUWOKlaNPmdHHnyE2o05rcumgy6DdBy5NdXcbg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760447990; c=relaxed/simple; bh=Nqq2/LuTW6vCVQBhBWXAS3bVVhvhJ4XHytcI3762lk0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Q8B0AZLmWtRkW6+3BgGvAuYFjEmBvv2uhWHfvV4M/iKCmbhcZ2uta9dyA+dRm9XetKJ/5IuZ/IU4kiVhuq2zezfFNxbvLtkMsFGH5qwy5582M/TiOXB9gKpkZrM6QVa5tTa5+UWw+seqSayockE9+s5TPAa6XcYGftMk1DeZAf8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=rws2QiQ2; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Received: from [192.168.1.182] (93-46-82-201.ip106.fastwebnet.it [93.46.82.201]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DACFCC7B; Tue, 14 Oct 2025 15:18:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1760447888; bh=Nqq2/LuTW6vCVQBhBWXAS3bVVhvhJ4XHytcI3762lk0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=rws2QiQ2mlXVkLzqn4GjbpbWhgrlDtsfF26I2zKC20X04INRl+R4Ex2Fz+/LIsedn bebwuU9ONDn80IGacOojF77NIPNWxvWTOoPj+X+N5CSMPcdbaNYsk2vT072uTRS58r 4ArAyaDdAd4C13AWpK535pxdrvhcyHxxiebzlIio= From: Jacopo Mondi Date: Tue, 14 Oct 2025 15:19:33 +0200 Subject: [PATCH for v6.18 v5 1/2] media: cx18: Fix invalid access to file * Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20251014-cx18-v4l2-fh-v5-1-e09e64bc4725@ideasonboard.com> References: <20251014-cx18-v4l2-fh-v5-0-e09e64bc4725@ideasonboard.com> In-Reply-To: <20251014-cx18-v4l2-fh-v5-0-e09e64bc4725@ideasonboard.com> To: Andy Walls , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart Cc: Dan Carpenter , stable@vger.kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=6363; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=Nqq2/LuTW6vCVQBhBWXAS3bVVhvhJ4XHytcI3762lk0=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBo7k3xf8blaG4dnBMTnaHoYC5/nBSnQUaydWx5p NwcJpFG8iKJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaO5N8QAKCRByNAaPFqFW PGgdD/wNxhWd/7yO6wb+5rlSobeTf73Wg4CARAD9rKUXnpxVctsO4YNTx7SQ9eKAjTE4m/1MENa USLJodUnjPFRGoMcVBu26FASBPgCKXRnDwj0bal9rOA5i/YBDXL3+BS9ih5CCRK7E667EO0ZFD4 o/vIQjxOJNYC9RFzw1J8TRdTt0vHlzcvacwnTYrd7SymbSO20O8xCPP82eH/3ya3nHH+uAkS3Q0 I6RxmI10mqbckcQw6w/KsA7ySsIct1i7CSmqVJ+YAcKfRSN/q4X7i0PrY+E7rgze0Jp06aTDRJF o/WjMSRa2enkxe/9o7tyEkconS2AGHNrdMHTCpG6PaaM1DKoLIBwxLlgTwhGk6j8w0/MANAYseW OQkC7UM56Nc0iztbN5rVFSM+BMARn/l00cW4eBtyHC3Gcv6Nu1ewZyT946y3fMS4ygMOjSVW6/9 38yg1nCNzWXIl++KeSkE3TJxawPsn/i0zVVtFAezgYEcg/aNDwG2iCbquWGH1MxP8/8afcSDOr2 zvuGW/BO1YFBVIIy5G3wJSILxbD+Gd3o1dG67jYwmvYdsHNgcqa1RMgJZuXdO37JwThQUUsZObG urKjxuWae3dcWedCszA+dH8ry3KQnZd60tExIS08FoDE4eXq6qoXa1eMEeIAAgl41nOn0LkpUCA Ab4zh19sVyR0VWQ== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B X-DKIM: signer='ideasonboard.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: ideasonboard.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 Sice commit 7b9eb53e8591 ("media: cx18: Access v4l2_fh from file") all ioctl handlers have been ported to operate on the file * first function argument. The cx18 DVB layer calls cx18_init_on_first_open() when the driver needs to start streaming. This function calls the s_input(), s_std() and s_frequency() ioctl handlers directly, but being called from the driver context, it doesn't have a valid file * to pass them. This causes the ioctl handlers to deference an invalid pointer. Fix this by moving the implementation of those ioctls to functions that take a cx18 pointer instead of a file pointer, and turn the V4L2 ioctl handlers into wrappers that get the cx18 from the file. When calling from cx18_init_on_first_open(), pass the cx18 pointer directly. This allows removing the fake fh in cx18_init_on_first_open(). The bug has been reported by Smatch: --> 1223 cx18_s_input(NULL, &fh, video_input); The patch adds a new dereference of "file" but some of the callers pass a NULL pointer. Reported-by: Dan Carpenter Closes: https://lore.kernel.org/all/aKL4OMWsESUdX8KQ@stanley.mountain/ Fixes: 7b9eb53e8591 ("media: cx18: Access v4l2_fh from file") Cc: stable@vger.kernel.org Reviewed-by: Laurent Pinchart Tested-by: Hans Verkuil Signed-off-by: Jacopo Mondi --- drivers/media/pci/cx18/cx18-driver.c | 9 +++------ drivers/media/pci/cx18/cx18-ioctl.c | 30 +++++++++++++++++++----------- drivers/media/pci/cx18/cx18-ioctl.h | 8 +++++--- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c index b62fd12c93c1a37ea6c8d3d48871028d81b33485..74c59a94b2b051b1585051e2e3ea3ee8fbd16630 100644 --- a/drivers/media/pci/cx18/cx18-driver.c +++ b/drivers/media/pci/cx18/cx18-driver.c @@ -1136,11 +1136,8 @@ int cx18_init_on_first_open(struct cx18 *cx) int video_input; int fw_retry_count = 3; struct v4l2_frequency vf; - struct cx18_open_id fh; v4l2_std_id std; - fh.cx = cx; - if (test_bit(CX18_F_I_FAILED, &cx->i_flags)) return -ENXIO; @@ -1220,14 +1217,14 @@ int cx18_init_on_first_open(struct cx18 *cx) video_input = cx->active_input; cx->active_input++; /* Force update of input */ - cx18_s_input(NULL, &fh, video_input); + cx18_do_s_input(cx, video_input); /* Let the VIDIOC_S_STD ioctl do all the work, keeps the code in one place. */ cx->std++; /* Force full standard initialization */ std = (cx->tuner_std == V4L2_STD_ALL) ? V4L2_STD_NTSC_M : cx->tuner_std; - cx18_s_std(NULL, &fh, std); - cx18_s_frequency(NULL, &fh, &vf); + cx18_do_s_std(cx, std); + cx18_do_s_frequency(cx, &vf); return 0; } diff --git a/drivers/media/pci/cx18/cx18-ioctl.c b/drivers/media/pci/cx18/cx18-ioctl.c index 0f3019739d03dab1ed8ba63f71134a5b64807c7d..0d676a57e24ec901f004e4b3765614b6142daf00 100644 --- a/drivers/media/pci/cx18/cx18-ioctl.c +++ b/drivers/media/pci/cx18/cx18-ioctl.c @@ -521,10 +521,8 @@ static int cx18_g_input(struct file *file, void *fh, unsigned int *i) return 0; } -int cx18_s_input(struct file *file, void *fh, unsigned int inp) +int cx18_do_s_input(struct cx18 *cx, unsigned int inp) { - struct cx18_open_id *id = file2id(file); - struct cx18 *cx = id->cx; v4l2_std_id std = V4L2_STD_ALL; const struct cx18_card_video_input *card_input = cx->card->video_inputs + inp; @@ -558,6 +556,11 @@ int cx18_s_input(struct file *file, void *fh, unsigned int inp) return 0; } +static int cx18_s_input(struct file *file, void *fh, unsigned int inp) +{ + return cx18_do_s_input(file2id(file)->cx, inp); +} + static int cx18_g_frequency(struct file *file, void *fh, struct v4l2_frequency *vf) { @@ -570,11 +573,8 @@ static int cx18_g_frequency(struct file *file, void *fh, return 0; } -int cx18_s_frequency(struct file *file, void *fh, const struct v4l2_frequency *vf) +int cx18_do_s_frequency(struct cx18 *cx, const struct v4l2_frequency *vf) { - struct cx18_open_id *id = file2id(file); - struct cx18 *cx = id->cx; - if (vf->tuner != 0) return -EINVAL; @@ -585,6 +585,12 @@ int cx18_s_frequency(struct file *file, void *fh, const struct v4l2_frequency *v return 0; } +static int cx18_s_frequency(struct file *file, void *fh, + const struct v4l2_frequency *vf) +{ + return cx18_do_s_frequency(file2id(file)->cx, vf); +} + static int cx18_g_std(struct file *file, void *fh, v4l2_std_id *std) { struct cx18 *cx = file2id(file)->cx; @@ -593,11 +599,8 @@ static int cx18_g_std(struct file *file, void *fh, v4l2_std_id *std) return 0; } -int cx18_s_std(struct file *file, void *fh, v4l2_std_id std) +int cx18_do_s_std(struct cx18 *cx, v4l2_std_id std) { - struct cx18_open_id *id = file2id(file); - struct cx18 *cx = id->cx; - if ((std & V4L2_STD_ALL) == 0) return -EINVAL; @@ -642,6 +645,11 @@ int cx18_s_std(struct file *file, void *fh, v4l2_std_id std) return 0; } +static int cx18_s_std(struct file *file, void *fh, v4l2_std_id std) +{ + return cx18_do_s_std(file2id(file)->cx, std); +} + static int cx18_s_tuner(struct file *file, void *fh, const struct v4l2_tuner *vt) { struct cx18_open_id *id = file2id(file); diff --git a/drivers/media/pci/cx18/cx18-ioctl.h b/drivers/media/pci/cx18/cx18-ioctl.h index 97cd9f99e22d9676d427a7e9e12fb572a91b2a82..42a8acd69735469af548d9e5ea95d60d786f83e3 100644 --- a/drivers/media/pci/cx18/cx18-ioctl.h +++ b/drivers/media/pci/cx18/cx18-ioctl.h @@ -12,6 +12,8 @@ u16 cx18_service2vbi(int type); void cx18_expand_service_set(struct v4l2_sliced_vbi_format *fmt, int is_pal); u16 cx18_get_service_set(struct v4l2_sliced_vbi_format *fmt); void cx18_set_funcs(struct video_device *vdev); -int cx18_s_std(struct file *file, void *fh, v4l2_std_id std); -int cx18_s_frequency(struct file *file, void *fh, const struct v4l2_frequency *vf); -int cx18_s_input(struct file *file, void *fh, unsigned int inp); + +struct cx18; +int cx18_do_s_std(struct cx18 *cx, v4l2_std_id std); +int cx18_do_s_frequency(struct cx18 *cx, const struct v4l2_frequency *vf); +int cx18_do_s_input(struct cx18 *cx, unsigned int inp); -- 2.51.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id sIWzGyVP7mi2ABsAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 13:24:53 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 13:24:53 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8f1J-00000007eRp-0cnx for hi@josie.lol; Tue, 14 Oct 2025 13:24:53 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2A9C33A791C for ; Tue, 14 Oct 2025 13:21:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E3AB3314B85; Tue, 14 Oct 2025 13:19:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="vYZW3A2a" X-Original-To: stable@vger.kernel.org Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 002FA1C84AB; Tue, 14 Oct 2025 13:19:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760447989; cv=none; b=li/Uqftx4yBdjJRqlLNglKEZKbtavBlHcw459SCsunNe6tYdM+6Ix270ezh5Gz3GEtLSPVwkJSYgS5SIJbLjqEMp2+I2vRCslcasn8CFY4N1ba09H8XtZPAKGnliLU2GKl+ZsmAIMppcUL1Xlo2Dmp1IEz3W6CLpAvaXPCUEEmQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760447989; c=relaxed/simple; bh=kWOu7e1w1cCAlaL468RTI3QNSoUUrTM/wU169Sfem5U=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=uU2WFU6TOepEWozuYcJPbxjPfeNDqywzDUwVyAZAHH8lU6r/y2m2Niz3R/YZ+Uo+3B9Qfly5jRioIrNy2n5xtVXMxFnNFD8Qzyz3dlJ+93JAGvPaoz2b3+R7bpssJzVCqxX/Ju3zKrhVCUIvUP45+2nVjg5IlXdRP5kOcgC5rfM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=vYZW3A2a; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Received: from [192.168.1.182] (93-46-82-201.ip106.fastwebnet.it [93.46.82.201]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6EF85C73; Tue, 14 Oct 2025 15:18:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1760447887; bh=kWOu7e1w1cCAlaL468RTI3QNSoUUrTM/wU169Sfem5U=; h=From:Subject:Date:To:Cc:From; b=vYZW3A2aU9QAJBzBg6sr4jNplhQmViA8CCkz0XKAyXTepZgZfD9XypvMTv1Vj0dh5 g7wdp+ofsug1AJzHakua8jjP2kFdvyPrQVJ3VHQX50cIevwaJM2jF8B2tV/hquiNWv AHA4F50kq0WlT0qmlVZ8J5b3/TU2J45Ycz4YWDeg= From: Jacopo Mondi Subject: [PATCH for v5 0/2] media: pci: Fix invalid access to file * Date: Tue, 14 Oct 2025 15:19:32 +0200 Message-Id: <20251014-cx18-v4l2-fh-v5-0-e09e64bc4725@ideasonboard.com> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAORN7mgC/33NQQ7CIBAF0Ks0rKUBplDqynsYFxQGS6LFgCEa0 7tLujKmupnkZ/68eZGMKWAm++ZFEpaQQ5xrkLuG2MnMZ6TB1UwEE5Jprql91FG6i6B+oj0ao/g weOeQ1JNbQh8eK3ckPqamqJZrcqqrKeR7TM/1UeFrYdssnDKqPHIJvWKjxUNwaHKcx2iSa228r l4R/wxRDfASLHYClIIfBvwzoBoShWfagzXO/jC6T2P4MrpqDG7kCqRTve43jGVZ3pEAxcOGAQA A X-Change-ID: 20250818-cx18-v4l2-fh-7eaa6199fdde To: Andy Walls , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart Cc: Dan Carpenter , stable@vger.kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1963; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=kWOu7e1w1cCAlaL468RTI3QNSoUUrTM/wU169Sfem5U=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBo7k3wFPG0lwdcKvdRDzFZaUEblL8SHh8zTTela cdjFNTniRSJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaO5N8AAKCRByNAaPFqFW PF+DEACfMjsThBVt0zUy18dzMRypo5SltMO+Rmeam34tX43bpxKEpTchFjiTDlT5vxJ0M9KeY4X 1wcV86hLtIaLca7qOvzOoe95oSBN37FqC/TiilrzB/cZRx76Nv+ITgjMGhWmRiV1m+OPtd919kl iAf2PHudpWiQjEef3Pvmsbr6IvE9fdatLP4QJwuNCWWRIs3QGGBMbaCBQt7dE/J5LV9LdWUqBws AJ4Ui52Pg85/QFyJTGg0s1ogDPMLsMYcEXy0DRpjAfO1R0cQm2SepjmJc0SybIKUvI9Lw22cwy4 2d2NcIg9Zn4E/J5GUcOuMLw/nnRuRVyo363RCkPrZvG6RGZBjeqLwyQltwITjGVyz0g7kOmhCWd 87rLaida90R43rdmjTn2mFdrGosARXWhTqcfnwCX8TKW3enq89X8NmtuA3ktcG5jsU9cJ+m9l5U mLwLwY9kV3k9vYSyz5WvOHmW7ee1Ja1ht/SVpCWt7CvvcqivEd4n0p6aG48r/++J4Qu7V/h4MU+ NLNq5NbEso+tDaGABnqChAq/FIwGOMOQEL5Dnpq18qz4REHZuQcEQ/Dw5KisnyByQ/4hhlkKC1U eZC+4nfTlHLU5q4yJtCl+SzLCyllEAmvnOXba1NxSw3IN9J0PAUN9YFiZleVMlzM4XOPmbQlPoJ s7aXin68xGeKXWg== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B X-DKIM: signer='ideasonboard.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 Since commits 7b9eb53e8591 ("media: cx18: Access v4l2_fh from file") 9ba9d11544f9 ("media: ivtv: Access v4l2_fh from file") All the ioctl handlers access their private data structures from file * The ivtv and cx18 drivers call the ioctl handlers from their DVB layer without a valid file *, causing invalid memory access. The issue has been reported by smatch in "[bug report] media: cx18: Access v4l2_fh from file" Fix this by providing wrappers for the ioctl handlers to be used by the DVB layer that do not require a valid file *. Signed-off-by: Jacopo Mondi --- Changes in v5: - Remove stray link from cx18 patch - Add Hans' tags - Link to v4: https://lore.kernel.org/r/20250819-cx18-v4l2-fh-v4-0-9db1635d6787@ideasonboard.com Changes in v4: - Slightly adjust commit messages - Link to v3: https://lore.kernel.org/r/20250818-cx18-v4l2-fh-v3-0-5e2f08f3cadc@ideasonboard.com Changes in v3: - Change helpers to accept the type they're going to operate on instead of using the open_id wrapper type as suggested by Laurent - Link to v2: https://lore.kernel.org/r/20250818-cx18-v4l2-fh-v2-0-3f53ce423663@ideasonboard.com Changes in v2: - Add Cc: stable@vger.kernel.org per-patch --- Jacopo Mondi (2): media: cx18: Fix invalid access to file * media: ivtv: Fix invalid access to file * drivers/media/pci/cx18/cx18-driver.c | 9 +++------ drivers/media/pci/cx18/cx18-ioctl.c | 30 +++++++++++++++++++----------- drivers/media/pci/cx18/cx18-ioctl.h | 8 +++++--- drivers/media/pci/ivtv/ivtv-driver.c | 11 ++++------- drivers/media/pci/ivtv/ivtv-ioctl.c | 22 +++++++++++++++++----- drivers/media/pci/ivtv/ivtv-ioctl.h | 6 ++++-- 6 files changed, 52 insertions(+), 34 deletions(-) --- base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787 change-id: 20250818-cx18-v4l2-fh-7eaa6199fdde Best regards, -- Jacopo Mondi From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id cPo1HmFS7mg3FR0AYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 13:38:41 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 13:38:41 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8fEf-000000087HO-0Tkb for hi@josie.lol; Tue, 14 Oct 2025 13:38:41 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5B1125401E7 for ; Tue, 14 Oct 2025 13:38:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DF289311C1E; Tue, 14 Oct 2025 13:38:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="JDILBQTZ"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="ulxfT7qF" X-Original-To: stable@vger.kernel.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (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 268783148D0; Tue, 14 Oct 2025 13:38:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760449114; cv=fail; b=Hga+mY17tArDqTqdKpoIpOTBl5krpOrDV4CybPkkkK8yoxRy7vbQLywrPtgu8pg4XalA++veJdczgrBC/rA2JgTkH06osNcW59Chf6fygvBio1hoTgIVzgd+HlRMECWtIeeGN97mpOZHDr3nKb/D4GuyBXGv3/9+F9zSHPI5jpA= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760449114; c=relaxed/simple; bh=oGuAJtavE53wHP7iWBmYz/OJeiZEdXnwCppBhe7q21o=; h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=nOvufvgiJGOogxa0op2IY0ZpRIocurpgZAOTW0bPUMk8CrQECYQEqXOCghZyBkZtMH/wLKNDNY5M1ign0F4PufTpT+01gcjF6SQaAaqDqhw7e/g0Uma/WTs9T2Kqm6ZRLszRNy7q/Nfppo/Yj8ja+zAMfkO4X3VPjwy3ClqLFSU= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=JDILBQTZ; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=ulxfT7qF; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 59ECu7uX013201; Tue, 14 Oct 2025 13:38:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=corp-2025-04-25; bh=uzdaZMPB4blosHYKQZ gE1n4wbVm2Lv5e3HM2M1/5050=; b=JDILBQTZy7YA7N2aaM+PaoR4ndgDOdlWOg /DKnwaGpMeNTCHg/hdxG8ZZmfSIUMZmDctN10hENeIGFTR4/1y2I5VkGeEGNqs/f Kf4u0Qh7wY4YOANaDycRcHzbvBZbDnah84dqe/OUvaIqaCQRqekxbApvYP+BhY0/ SpEDZykwD93j5PvwiA+1RStMWXm91PwMnz7utErIsILKhmb8Qt9Wh1zd7jNUOaR0 XWN30bmGNgON5/DfBK5hxoWhnrXyg68CPk0dodCtE4Lp64A2RqnGW7z4gjWXgCkf r3Jk+rMh2uHJ682Wly+9E2V0L9z1rYPqz13eMsuoehtFRWI5YRsg== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 49qf9bvd1c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Oct 2025 13:38:16 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 59ECc4JB037871; Tue, 14 Oct 2025 13:38:16 GMT Received: from sj2pr03cu001.outbound.protection.outlook.com (mail-westusazon11012045.outbound.protection.outlook.com [52.101.43.45]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 49qdpeyhht-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Oct 2025 13:38:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KfK3XdCVDafKew9OeVunmrzvbr7QZc5Q05BMN+GBzwBG4QlgxT5MtKnrt7u1jOxY3eMw+b3FxVObaNEMSRqsoJwcTEmGBmpGkgosffO92c1KI3Tf6JsOiCF+qEnuo08+fVavPpZCvwB71g7I/W/zdE3CNzx7YLt0Te5mL+L8L3yo37Q5GjuYVHaw2Wewpi4aB7lBKjoQDTUGpVVNIuSPiaaP9LC070bjuK8vMTF2VHiNgVQjogGYvvH72j8wR/l5j9KPBW9E1oRtaxAM1wZ023NKyCmqicR99VjzzZEnpvn2oqobG0em29pP3N/FkD53qA2t4kcr7axK6oxD+mKLhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uzdaZMPB4blosHYKQZgE1n4wbVm2Lv5e3HM2M1/5050=; b=jrJTgZmg6JgArRvYhDZJqdJrD6lB7KGKkuYIunlcDqe3iKE6+7a49XhK6PpOkmVqe36xApvq3VpxZdXHLsv3aaeCgsz+yLAhmcIZW2snueNbLoUH7Jt063LkrUPahhlaGc6xix43Zu6JWjp5pIgN5C6LEeNlGXTkFyEzK8MgY7elbwr2BncbLSTdzrEV/o3VHClwbj+Em7icLoVJ/EKmvGYdy7j7uBbkOLhEu4uWmenEr+k8+YVXl5tsor5NF8qJeZlUrfz0IV8NUv8SaphX49D16O1hgs/MluWPq79R5/qLZgAv8FaD0Vm8aFmit5XfNk8E0RfYs//oYKsPnPxXmQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uzdaZMPB4blosHYKQZgE1n4wbVm2Lv5e3HM2M1/5050=; b=ulxfT7qFnJnaR3dMy4He9Q1Gi4jd8DHe0Med8QjeyYjd3AI6PDflclEhXOIYegkdWoeAuIN4eh2164hy3KCtiZwSEJ8tMs3mBC8yYAPXIiloQmwb3my8It6FcaOFtzECGA/CAT7d6WMrOyBotqwrGdrTgsJEIfbUAShG/PjTZ6g= Received: from DM4PR10MB8218.namprd10.prod.outlook.com (2603:10b6:8:1cc::16) by SJ0PR10MB5892.namprd10.prod.outlook.com (2603:10b6:a03:422::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9203.13; Tue, 14 Oct 2025 13:38:10 +0000 Received: from DM4PR10MB8218.namprd10.prod.outlook.com ([fe80::2650:55cf:2816:5f2]) by DM4PR10MB8218.namprd10.prod.outlook.com ([fe80::2650:55cf:2816:5f2%2]) with mapi id 15.20.9203.009; Tue, 14 Oct 2025 13:38:10 +0000 Date: Tue, 14 Oct 2025 14:38:07 +0100 From: Lorenzo Stoakes To: Ryan Roberts Cc: Andrew Morton , David Hildenbrand , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Amir Goldstein , linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v1] fsnotify: Pass correct offset to fsnotify_mmap_perm() Message-ID: <24b1fc5c-32bc-45c4-beeb-f794e0fd0b79@lucifer.local> References: <20251003155238.2147410-1-ryan.roberts@arm.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251003155238.2147410-1-ryan.roberts@arm.com> X-ClientProxiedBy: LO3P123CA0014.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:ba::19) To DM4PR10MB8218.namprd10.prod.outlook.com (2603:10b6:8:1cc::16) Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR10MB8218:EE_|SJ0PR10MB5892:EE_ X-MS-Office365-Filtering-Correlation-Id: 169f59b8-a4aa-4c86-538f-08de0b26ea72 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|366016|376014|7053199007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?tmG8Bed5TELOq9oPmtxhjJdGG6xT7QLRY+MY/BqG4vr9qBRYKW4IOqydfDRn?= =?us-ascii?Q?guSDESKjBqv9Qf0+DaygAPcm+Hpat77MD3KlpOeL4G4mOa1LOoovyJJkF1Py?= =?us-ascii?Q?OEu2wsrbuLfNfOoyEkoygTxP6Fqr0vNMqAFNMYdjdTMMOFQIznf7klaGWFIZ?= =?us-ascii?Q?M5kILydE+SLYr8Guyf1PYDmB23kZBRBHdOcDrGoSYrPArUtc6sQxj0UiWgaL?= =?us-ascii?Q?ah5fFr+i/8MhVQLt0iM591wRheo2ggLN+nMGS0JMCrD3X+iNAs07ffy3/43Y?= =?us-ascii?Q?6Oxnz9BpCwOSUfGgqm44X1IRZnG9HV+WgdM/HdVqREsQtDQfPYx6k86BjQxp?= =?us-ascii?Q?I96nXqCYN5/ciOtMeyUESR1NC+vw57Cu28wFbaN7a8sSCJhzb+VV31E3/CfG?= =?us-ascii?Q?DoVcKB4xdFKP5EI/nOOMM8jfSgyKqa6QsBNEGJ2va1B4kwq7+rHKDj/sv4ny?= =?us-ascii?Q?8+ZZfDtnOX2S4/SM25bG5nvHKOv56uwfwzgifyyFKd+ML8UXFXvhXrALkErd?= =?us-ascii?Q?UY34efSmaA6dg1s94HPR95eemQJoA3PLM/x/oPISvbhvtczzn9aAOkmgHW7Y?= =?us-ascii?Q?LpZyAMrpEKwhhE7U3MvQBi/COEh4JwBsboTqO7j0MDaKWG3igZNpNsWl9BFy?= =?us-ascii?Q?0Ii44T1vLYcvfF7U74MJ1j6a8NuWuGGy8gkw/cSXDVSKlxhcvsmmQ+7sNu1m?= =?us-ascii?Q?cs6rCWbOuRp/5dG9+IPMVz3aUEEIhWG3IEDgh0g52NKP7iAINWVD4JEgdoc4?= =?us-ascii?Q?/eO9i4yeL9rAlLl/A81S3fhAJzdaa19onrGezem2Qq/YmWjGfdSzfJ9n0nV5?= =?us-ascii?Q?FI5y6amoKqPh3EbKuiZ1KnaNYVkadDC+j4bMyjXfnfsQiRv9TqKLoARJT6hV?= =?us-ascii?Q?5USFMSJbl3EoiwMAkRdlirPybDX5HBNRF8WH7RneCmS+RAXOSqpK6xhKJW2t?= =?us-ascii?Q?zQTv99SY582O2Ct6Wdqeo6ZtKHd16o1JP8Rm/Ww4qTUP7LS2f+2vpPqLFfeg?= =?us-ascii?Q?Ka6aEG6uNe6jMEONdCFaMd8EW8ZmrPesS8PkZ/M1zCuYkgc+J4w+Zswv/yGD?= =?us-ascii?Q?Jse0kN0D7il4n4WAF6U3ipLFLvGJ/+ZcMZzmiSkEUDlxKJ6if2CzONTW9f1u?= =?us-ascii?Q?Qpd+5nVlV+/52MJvw+7BC3fhgLP1T1x94d4BskDPvthS6PDJ/1iO1hkJuP1C?= =?us-ascii?Q?qvh4XcaUcQHRqOepAl2P1wieIZN4k/XdannKG7uwtHqMIQEEdvwgNImRlRMo?= =?us-ascii?Q?US36hsQAj1gjYx1FP+bUCb8RsriXrGEOgaLWHPCQybutjFpanIK9Vdn1dtCl?= =?us-ascii?Q?tWNdyk0n0bi6qWuwxdURyqd4vMhvPcel8bUX9u3ASEhNRAtqTl9mHOl47NIX?= =?us-ascii?Q?jKnGXYJVXy2iNUjTIfomtZeHgxCD8jQjhT/wvUL0WQYwK3LCV2fy3AqUuxON?= =?us-ascii?Q?OTg3cPy0R7NSrZhZbYF5aRoeAJEolwgM?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR10MB8218.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(366016)(376014)(7053199007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?/3NE9kk9fL/t8XXP7eC9S0p+ivtcFCcJxZGmQjRVcQdSM2rjjueIFC/B2i9U?= =?us-ascii?Q?khByg2lJqNi+NyEkJSaPE9WSGAYbqBAnQkPO750x+tiunaxLwaIF1jw4Tdw2?= =?us-ascii?Q?6PC/VUKaOcxEHICAj798U3fAfuuVzcVgbBXZnemOjlZ3/CAUFo3V5Wj2hhAy?= =?us-ascii?Q?2cwTwZmi2DuMjwM8gSjFuSDG0DnT99KMnwsRQuR6pM3HVV5RA3fUV0vvQ37i?= =?us-ascii?Q?hvNo6/hoXLC3vm0G2xcTCequ2mCoi0pRBPJpL0Rb2PBtMrCQLcSj73jM4qFK?= =?us-ascii?Q?BaNl9YUheDL03tLElB2dXDNTBaDb24JMn1bFOu8UFqs5RChcZMPuV/QNiuRD?= =?us-ascii?Q?exIwNfBtD88o+yP6n8ob6odu8Iz/oQ5DFsD61b3s+3GIf1/fpeXtUUUhtqEv?= =?us-ascii?Q?MJKVFH14ugEjkCLA1jE8kC15ExanNyaXetnWtcCYTrT/6kBBWdCzJgYHPYzr?= =?us-ascii?Q?Pj79Ao3oVxv8HlrU60P1CQ95XW74ufKGxpGC2BY/ioDk1ZoSaVVK/QFW/MPX?= =?us-ascii?Q?RPViwwvnVbKFkrhFrqPxSUQFkLTR3V4IZ4TgSKztViijl6sZadNTICjtAdYb?= =?us-ascii?Q?KeJYnd3yG1Mk5tY+R4AuADnd15RKp7kKW2xjCK0Ro3xeG2msFtkjUwNGps6b?= =?us-ascii?Q?jS9Z9lxWmHhwUWz8RGoJAw5DEXgtqW9ppYbNe8Ajnf+54L05o3Rgm9OI3Ypz?= =?us-ascii?Q?s2xnqhdwkD5SsKxvRRsXrfFlj70wa3E1HFVD6g1cbm/byhdiuB3Q0VSDFd47?= =?us-ascii?Q?WRarbTsNoQxYYCPjIf04HSNQnkEsERDCTMx1s1YL/utgzCD3kX5PQA9McfRs?= =?us-ascii?Q?iiRINvA2/l3BUbnhmE7XkkVoKDwiYnv2YJ16R7q9DS4r3nLSsE9AmizgDWUE?= =?us-ascii?Q?p4ctttaPxPEG6iZpKvpXHdJQXmI/R0XwK/tzoqOvgJT+Uu7QycT8t57Ibv4k?= =?us-ascii?Q?fVomRF8Rt57LpY1FDeXfYg9KLIztameks1ml+eQleseCIgBQ2gXimuLgbUvs?= =?us-ascii?Q?78gTnD2qo5d64in8551DxE+vZ/2uFePTLl8I6HSB2ML08UImBodKSf0mTic5?= =?us-ascii?Q?dcrvYVROkQtw9W6VFw9j676bcKGl/Z/V7rILBqYzv3g5sVbVvUdsmHElzXgL?= =?us-ascii?Q?AIaaI8xS25qknwIQUh+Ui16WcVcfJuwB9RmSlHazaS3P+Ce7Wej6a10S2xLb?= =?us-ascii?Q?E04AW7SDDJSaSOkq75h8jK16/DJkMk006H4ZJjriP6lEJe7hcOW5s8oVd7MV?= =?us-ascii?Q?VaZ4O/RgjK4h+TfaqOnpGXT3cdcv2cYoTcOhx9N6tvb8yH9M7P14E9hjpShw?= =?us-ascii?Q?SF7eoKwgyGAFou4LDHkomXYef4mScbYKMZW+nUOu2KVHP8dwba27vyYSkic2?= =?us-ascii?Q?BeeQcce/NIf6DNIvTVMcyugJJ4wjopG7SIXdQ+D4vd5P6UUVqjWf7XzWD2Iy?= =?us-ascii?Q?eTOcCx0HDbf5l/GBHc5Fzj/nDn9iDwQ0aHq0O6ZlIHZ7cD/2PS11Vsm8eWtL?= =?us-ascii?Q?uA8rGXdujUZJdxBgD0HSgen1+xRHcav19ILRzLCIEbvUKtEPzn6hxk5GLYAg?= =?us-ascii?Q?ipYaU8LeOJGWVOXFT8NeqKava42nzifuS4cTUgre6/Ts4l4ZjPZiFL8JfJJj?= =?us-ascii?Q?Og=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: okBTEeUzsRxKHk9MMpuVarLxHaOsm+L+NNtIijMaM9uBz2azowG6SOy3N0HDkbEzhHOJMaWPEyvdeiw6qY1PAbnw51t6TdjJZQM5YqKbB1VHY1AP76x7na6UtYRYeH22zxTzzQxXnoEdMyqmlf/hN2ztRqPUgQakMBaYB4mdUlYusYehw+Zm8BCaM5VwwnL3AnmndADEvvUaELjWeBANGxXYKPwbOsmcgRFIYulCnYzjVFGsJo8HU458V5GzBNLRPNjqMve4HDSLf1XfYnVSOgM03oz9yPs0laStg/7HF43AWmQzahdJ5pPVz1DIgG7aV2ST1tIuhhNbfqc+IQdSYzjB28Ss6qn+dfN8iswnB5A27WvOzFEIGvD4vI1E23fcA1gXZ10mZ57r/FhoyXuzX6CBRrANdUICHIEUfBbbANcTTdBWe9sMc9E/Tv59BcZ1g+hm9UljPvlj5WZLflQp/LzlRp7rIsYY2LyWJc2AcXtkbiuAR0JPClBLinwj87705mwrpAuz75s0YhYJLtjO1Qg2GHf7b3JAvXcxdfvUU6JQJsgD9siNPUFaslQ/x2PwknDDwh9HBeD6AkVn7SJXqJXmAb+wU7drzC4ZnFtf8jw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 169f59b8-a4aa-4c86-538f-08de0b26ea72 X-MS-Exchange-CrossTenant-AuthSource: DM4PR10MB8218.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2025 13:38:10.3908 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vPAU+e1dP6COo5r1yk0zuVgzlE0rEMO2AVGzk+P0YBMJMI+Bk3x27GEaj4Hlak10a3JfrL70bHgSxalSkQApRSckJr5Ct2sxNks1Qc/571Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5892 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-14_02,2025-10-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 spamscore=0 suspectscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2510020000 definitions=main-2510140104 X-Proofpoint-GUID: dW32L5HtMZkNis3rNns6eLCUjPPMM73Q X-Proofpoint-ORIG-GUID: dW32L5HtMZkNis3rNns6eLCUjPPMM73Q X-Authority-Analysis: v=2.4 cv=QfNrf8bv c=1 sm=1 tr=0 ts=68ee5248 b=1 cx=c_pps a=zPCbziy225d3KhSqZt3L1A==:117 a=zPCbziy225d3KhSqZt3L1A==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=x6icFKpwvdMA:10 a=GoEa3M9JfhUA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VwQbUJbxAAAA:8 a=7CQSdrXTAAAA:8 a=yPCof4ZbAAAA:8 a=t1Kh4uhbCuRW0kA8Y-oA:9 a=CjuIK1q_8ugA:10 a=a-qgeE7W1pNrGK8U0ZQC:22 cc=ntf awl=host:12091 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDExMDAxNyBTYWx0ZWRfXxPQWlICD5ivL L2qWuKCXz5UbcCjTC0HPgIwQMYEGd9pWaB7/Ua/HTCeyLfU2JcddNfFEZSH4S/jve+BGHO1jikm zjV3s3azZY8QZ/8tgLEC89awlMoh7gAQWUbDibXZiNi0Bj9MNXCVclDPj9Li8UxoQ0KW1+47nLn ZuAhlyfzDBnszwaDdXReA7OQ0O7BtKnv5G0BNW1H53AnEsQN/AF1QLzThdF62rMz4uGLmu7/bMH DVLM1Q8cgxh7sjNACVoRQS/uTiHMxQYBX0scG1/9lbiMUbc503giSTJPKkpgEsFvbMenvw1YpLL lfH5+pxqq8Td7HWs0m9+cFICbpT10CdtGls6jcuH2GTSUSJFMnOtlPsYKGmASwtRBHu/HfRgYaJ 6haI1X9HXmRvZ+H7r63pZCLI2ngnWpjHnwFgDBOywg5Cjpcn6AQ= X-DKIM: signer='oracle.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-DKIM: signer='oracle.onmicrosoft.com' status='pass' reason='' X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: -18 On Fri, Oct 03, 2025 at 04:52:36PM +0100, Ryan Roberts wrote: > fsnotify_mmap_perm() requires a byte offset for the file about to be > mmap'ed. But it is called from vm_mmap_pgoff(), which has a page offset. > Previously the conversion was done incorrectly so let's fix it, being > careful not to overflow on 32-bit platforms. > > Discovered during code review. > Yikes, that's kind of crazy that has been in place for so long but not picked up... > Cc: > Fixes: 066e053fe208 ("fsnotify: add pre-content hooks on mmap()") > Signed-off-by: Ryan Roberts Thanks for fixing this! LGTM, so: Reviewed-by: Lorenzo Stoakes > --- > Applies against today's mm-unstable (aa05a436eca8). > > Thanks, > Ryan > > > mm/util.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/mm/util.c b/mm/util.c > index 6c1d64ed0221..8989d5767528 100644 > --- a/mm/util.c > +++ b/mm/util.c > @@ -566,6 +566,7 @@ unsigned long vm_mmap_pgoff(struct file *file, unsigned long addr, > unsigned long len, unsigned long prot, > unsigned long flag, unsigned long pgoff) > { > + loff_t off = (loff_t)pgoff << PAGE_SHIFT; > unsigned long ret; > struct mm_struct *mm = current->mm; > unsigned long populate; > @@ -573,7 +574,7 @@ unsigned long vm_mmap_pgoff(struct file *file, unsigned long addr, > > ret = security_mmap_file(file, prot, flag); > if (!ret) > - ret = fsnotify_mmap_perm(file, prot, pgoff >> PAGE_SHIFT, len); > + ret = fsnotify_mmap_perm(file, prot, off, len); > if (!ret) { > if (mmap_write_lock_killable(mm)) > return -EINTR; > -- > 2.43.0 > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id gOQpOt705GgsLhgAYBR5ng (envelope-from ) for ; Tue, 07 Oct 2025 11:09:18 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 07 Oct 2025 11:09:18 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v65ZG-00000006zYQ-37bM for hi@josie.lol; Tue, 07 Oct 2025 11:09:18 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 329724F4C60 for ; Tue, 7 Oct 2025 11:08:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D7F962D8396; Tue, 7 Oct 2025 11:08:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YTc6VxMn" X-Original-To: stable@vger.kernel.org Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 143332D7DCF for ; Tue, 7 Oct 2025 11:08:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759835305; cv=none; b=mn43hjYup1f/GpPdkjzDVYhjRWWqjkNPBgTBXLeP1J3t9VewUTgjTstvF/j6gDNbr+npM2e7aSH1w7Bqnz9JMRlmqutNY8/b4IACvBv+njDeNsOSgQ8LmZd7ydZlt3mxo/rQMKKG0mNZ6vX+0fMeXo/3Nz+IoYeviXFDOktMVVs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759835305; c=relaxed/simple; bh=UYjxP2t5m3TSDV72mhr1AaddvxDwKD3qqqOjv0SKlxI=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=WzVDlD05SgfGqszF8fbmQSRWs2wE9UdPrwbxqIrLFlI6kU5VnVyohDSMnRsuPyw4HZul4jC+OU7+N1ZYzF/WdiqtXRrN8d/i4/fyfWvgWB8QwSdpsNq7pEXBHtKtwTn37CEfE5CUQihmTGmJOScHWv1a/t0781gLwbuewZoF0Z0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YTc6VxMn; arc=none smtp.client-ip=209.85.218.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-b4736e043f9so1087273766b.0 for ; Tue, 07 Oct 2025 04:08:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759835302; x=1760440102; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=UYjxP2t5m3TSDV72mhr1AaddvxDwKD3qqqOjv0SKlxI=; b=YTc6VxMnrbOxAxg0dymgOMnAKNqjMIyuPLXBH6eEu6/JVt/86hfbdnVhS87c7bxKdf ZAapAJKUDHw7nBE0p4fxdPzfII/LpqegteJ58dR4HuGAJaeSJtr4rIU2uUQyxX2Hk/0z lme16YJPCk+/Pkrz8w/OIZ1NQG+mG0ZHJu1X4LyZNsF3nuiHF3VrmOq8eRA7mAc61a7K 2X19cVg+GMNJrmVt8yq9xI5u5zRSuq1ldT3/MdFipk1UraUfPatmutd10Q3VlynE91PJ S+PgoTaHPN30XSYofAJ9N7f9O/+uzl016zS1il2OI3P/DCTbZgfhP4FdVwd3ZX5s4ahP XFcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759835302; x=1760440102; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UYjxP2t5m3TSDV72mhr1AaddvxDwKD3qqqOjv0SKlxI=; b=rGVurop/H262hO8ZefSiWVQWz1uc0Z+7hwEgv97/hBAnS2XGOuQDwuxhUwwbxUy935 fTvSRGBupSlCv+R1dMxtIXy0K2xDTNUHNvbyVCZ+xsv2FKwDWpFJDVOsV9H9bEsN6Pdx cE4I91isdgpnHMp8DUgEO6KLz55lh0+AAW9peJumkLbNNHmtiyJ6+loZZLJQR6haoRCe P9sAO99Px60gCLHFxriae9gEOxChUA4l4+mNpsHpVQijTm/ysCtWNvTslLKQq5g0aj/l pVBcy6kUNTm3B4DYawO9YY3CLZ8CsfHLPwWjGeTRQ6bxLi/Vud1uX70yj6FcPbKJxfy0 Nlgg== X-Forwarded-Encrypted: i=1; AJvYcCWD02Z39OUg8zYW5W3cq9quyLGmW1MVYOptLktHcWd4cwAH+7GkfHW6YFWIuVbWfiP4fFJBv0o=@vger.kernel.org X-Gm-Message-State: AOJu0YwklgC8f7HBr/8g/WMVn3oDf06cn7u4tCyaE9ZWZbsJ0H46tyG6 l8WExo6kwbeZ0su8kmu5VS2NLGj5StPPo5Omo/ngO12zgJUnG9Lo576OcWlolf46kUV8IF4sR3J HsZt+ZzXxM81dcWF0P9mYF0GhwlDrivo= X-Gm-Gg: ASbGnctvvzetDI6v84psLd9SZC19uyAdYOt5UXLm9tyIiWfV46szH6qnG6kKYl7w/5T 9k6OQybTOds2no3F/E2TXCDW6fqVdd/sYz8DzGOyXAeVtb+VKL9i9tlLYAGLk8cDWCRHE33oE5L OCPopWi0bk2rEUCivHx6kEP0EYk1KWElPixVce8IbnCFdsztW7rOyOT7SmoLqHVCcXOdV0MzZoI U4h2364KkGzprdOdwKP+X20YSwZZwe03tY+3XcPhs/7Xl57EHVfI5W226SsOZtQPw== X-Google-Smtp-Source: AGHT+IHTIee9up7m92yTA0Zsk+7eOEOmCuPn1i2HEpHrFMMVIsPmZ/Ha7QPfPMEmx8EgOfImzZOVCi5jgu6WcAE+r2M= X-Received: by 2002:a17:906:4fce:b0:b40:98b1:7457 with SMTP id a640c23a62f3a-b49c4cde268mr1621336566b.47.1759835301952; Tue, 07 Oct 2025 04:08:21 -0700 (PDT) Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20251003155238.2147410-1-ryan.roberts@arm.com> <66251c3e-4970-4cac-a1fc-46749d2a727a@arm.com> <989c49fc-1f6f-4674-96e7-9f987ec490db@redhat.com> In-Reply-To: From: Amir Goldstein Date: Tue, 7 Oct 2025 13:08:10 +0200 X-Gm-Features: AS18NWAe14dfNSbsR0j5kwg1mzZpCKRfTUR5zwp4QxEyNvIbDN-ZzhaGc85_2tM Message-ID: Subject: Re: [PATCH v1] fsnotify: Pass correct offset to fsnotify_mmap_perm() To: Jan Kara Cc: Ryan Roberts , David Hildenbrand , Andrew Morton , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in sa-accredit.habeas.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [amir73il[at]gmail.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On Mon, Oct 6, 2025 at 4:40=E2=80=AFPM Amir Goldstein = wrote: > > On Mon, Oct 6, 2025 at 3:53=E2=80=AFPM David Hildenbrand wrote: > > > > On 06.10.25 14:14, Ryan Roberts wrote: > > > On 06/10/2025 12:36, David Hildenbrand wrote: > > >> On 03.10.25 17:52, Ryan Roberts wrote: > > >>> fsnotify_mmap_perm() requires a byte offset for the file about to b= e > > >>> mmap'ed. But it is called from vm_mmap_pgoff(), which has a page of= fset. > > >>> Previously the conversion was done incorrectly so let's fix it, bei= ng > > >>> careful not to overflow on 32-bit platforms. > > >>> > > >>> Discovered during code review. > > >>> > > >>> Cc: > > >>> Fixes: 066e053fe208 ("fsnotify: add pre-content hooks on mmap()") > > >>> Signed-off-by: Ryan Roberts > > >>> --- > > >>> Applies against today's mm-unstable (aa05a436eca8). > > >>> > > >> > > >> Curious: is there some easy way to write a reproducer? Did you look = into that? > > > > > > I didn't; this was just a drive-by discovery. > > > > > > It looks like there are some fanotify tests in the filesystems selfte= sts; I > > > guess they could be extended to add a regression test? > > > > > > But FWIW, I think the kernel is just passing the ofset/length info of= f to user > > > space and isn't acting on it itself. So there is no kernel vulnerabil= ity here. > > > > Right, I'm rather wondering if this could have been caught earlier and > > how we could have caught it earlier :) > > Ha! you would have thought we either have no test for it or we test > only mmap with offset 0. > > But we have LTP test fanotify24 which does mmap with offset page_sz*100 > and indeed it prints the info and info says offset 0, only we do not veri= fy the > offset info in this test... > > Will be fixed. Jan, FYI test enhanced and verified the bug and the fix: https://github.com/amir73il/ltp/commits/fsnotify-fixes/ Will wait with posting the test until you merge the fix to make sure that t= he commit id is not changed. Thanks, Amir. From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id +DyWJW7d42io6T8AYBR5ng (envelope-from ) for ; Mon, 06 Oct 2025 15:17:02 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 06 Oct 2025 15:17:02 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v5mxS-00000000Pro-18lB for hi@josie.lol; Mon, 06 Oct 2025 15:17:02 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 43E644E4694 for ; Mon, 6 Oct 2025 15:17:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3DF081B87C9; Mon, 6 Oct 2025 15:16:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="JfEGVaD3"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="28LwVFZv"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="JfEGVaD3"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="28LwVFZv" X-Original-To: stable@vger.kernel.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BEA9194C86 for ; Mon, 6 Oct 2025 15:16:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759763818; cv=none; b=A92DBcx/KGrt6L6qMiRqnwWQ6+a9N1qyOr5ucmNAaLc6+9j4msRQxB8y0Z+5NZRLm+wYHUXvPV6jy8rzX6XndF9X/RbPGh3RHeab3noIRbHloz0E3P7g5fsV0iQlQkG7/eTgexlFtLWl4wYvXpqU6/ly2tYsESjxDIeVNK7VcqU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759763818; c=relaxed/simple; bh=peOE6eITOVQUeZwE5IMNl27NOUYJJIKBK0gTxg2ZGTs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VQCnYRIDJZYEQdZLMT/XQhDC9SdMbV5XOj9FBypiY8rF6GCLDZ2ne2XLjEzJ3lylNJNSQWt2VxsJ5KASMtOqacViHKIND2ov6X2rp5106TQWdqxmfmfJt6GuvwdvhgRzXRL813wByB04Z2j96G+Flw5MWkQN8wh1zTvtlev1suA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=JfEGVaD3; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=28LwVFZv; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=JfEGVaD3; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=28LwVFZv; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 5E5721F451; Mon, 6 Oct 2025 15:16:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1759763814; h=from:from:reply-to: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=7iUrqCG2h/I1kRo24kmzmf4tFUsBJ4OjTnSbR2SFuFU=; b=JfEGVaD3xh5+rmLVKhixC+7z96nZowCL5NScoOMVuVk/bQIwvSbew88VA/YM6Q7niHB+Ag Iu4Wzd3N7rR3qQ92Ba5vXEgxrsQ205qSrLwGB93NY38ApH+cRZBmIF1RaNcYvAbPjbAbLv ilo09AW3jes1CZK2ISoUb95Ql6t965U= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1759763814; h=from:from:reply-to: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=7iUrqCG2h/I1kRo24kmzmf4tFUsBJ4OjTnSbR2SFuFU=; b=28LwVFZvAKU+Z4+kGtMvQyiy8dMdufZOzfvwRYUH2295mE216DJt13+Aq02HqstGEILoy5 2YhoQSZ9xhbKJMCQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=JfEGVaD3; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=28LwVFZv DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1759763814; h=from:from:reply-to: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=7iUrqCG2h/I1kRo24kmzmf4tFUsBJ4OjTnSbR2SFuFU=; b=JfEGVaD3xh5+rmLVKhixC+7z96nZowCL5NScoOMVuVk/bQIwvSbew88VA/YM6Q7niHB+Ag Iu4Wzd3N7rR3qQ92Ba5vXEgxrsQ205qSrLwGB93NY38ApH+cRZBmIF1RaNcYvAbPjbAbLv ilo09AW3jes1CZK2ISoUb95Ql6t965U= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1759763814; h=from:from:reply-to: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=7iUrqCG2h/I1kRo24kmzmf4tFUsBJ4OjTnSbR2SFuFU=; b=28LwVFZvAKU+Z4+kGtMvQyiy8dMdufZOzfvwRYUH2295mE216DJt13+Aq02HqstGEILoy5 2YhoQSZ9xhbKJMCQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 4F1DF13AAD; Mon, 6 Oct 2025 15:16:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id D7NJE2bd42gILAAAD6G6ig (envelope-from ); Mon, 06 Oct 2025 15:16:54 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id F1784A0ABF; Mon, 6 Oct 2025 17:16:53 +0200 (CEST) Date: Mon, 6 Oct 2025 17:16:53 +0200 From: Jan Kara To: Ryan Roberts Cc: Jan Kara , Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Amir Goldstein , linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v1] fsnotify: Pass correct offset to fsnotify_mmap_perm() Message-ID: References: <20251003155238.2147410-1-ryan.roberts@arm.com> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Level: X-Spam-Flag: NO X-Rspamd-Queue-Id: 5E5721F451 X-Rspamd-Action: no action X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spamd-Result: default: False [-4.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_NOT_FQDN(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; RCVD_COUNT_THREE(0.00)[3]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCPT_COUNT_TWELVE(0.00)[14]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_SOME(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_TLS_LAST(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; DKIM_TRACE(0.00)[suse.cz:+]; MISSING_XM_UA(0.00)[]; FREEMAIL_CC(0.00)[suse.cz,linux-foundation.org,redhat.com,oracle.com,kernel.org,google.com,suse.com,gmail.com,kvack.org,vger.kernel.org]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.com:email,arm.com:email] X-Spam-Score: -4.01 X-DKIM: signer='suse.cz' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in sa-trusted.bondedsender.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: suse.cz] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On Mon 06-10-25 16:04:23, Ryan Roberts wrote: > On 06/10/2025 15:55, Jan Kara wrote: > > On Fri 03-10-25 16:52:36, Ryan Roberts wrote: > >> fsnotify_mmap_perm() requires a byte offset for the file about to be > >> mmap'ed. But it is called from vm_mmap_pgoff(), which has a page offset. > >> Previously the conversion was done incorrectly so let's fix it, being > >> careful not to overflow on 32-bit platforms. > >> > >> Discovered during code review. > >> > >> Cc: > >> Fixes: 066e053fe208 ("fsnotify: add pre-content hooks on mmap()") > >> Signed-off-by: Ryan Roberts > >> --- > >> Applies against today's mm-unstable (aa05a436eca8). > > > > Thanks Ryan! I've added the patch to my tree. As a side note, I know the > > callsite is in mm/ but since this is clearly impacting fsnotify, it would > > be good to add to CC relevant people (I'm not following linux-mm nor > > linux-kernel) and discovered this only because of Kiryl's link... > > Ahh good point... Sorry I was sleepwalking through the process on Friday > afternoon and blindly sent it to the maintainers and reviewers that > get_maintainer.pl spat out. It didn't even occur to me that this wasn't an mm > thing. :-| No harm done really. The change is an obvious fix and it would find its way to the kernel sooner or later. As I wrote above, this is just a note for the future to think a bit about patch recipients before hitting send :) It may help to get the patch merged faster. Honza > >> mm/util.c | 3 ++- > >> 1 file changed, 2 insertions(+), 1 deletion(-) > >> > >> diff --git a/mm/util.c b/mm/util.c > >> index 6c1d64ed0221..8989d5767528 100644 > >> --- a/mm/util.c > >> +++ b/mm/util.c > >> @@ -566,6 +566,7 @@ unsigned long vm_mmap_pgoff(struct file *file, unsigned long addr, > >> unsigned long len, unsigned long prot, > >> unsigned long flag, unsigned long pgoff) > >> { > >> + loff_t off = (loff_t)pgoff << PAGE_SHIFT; > >> unsigned long ret; > >> struct mm_struct *mm = current->mm; > >> unsigned long populate; > >> @@ -573,7 +574,7 @@ unsigned long vm_mmap_pgoff(struct file *file, unsigned long addr, > >> > >> ret = security_mmap_file(file, prot, flag); > >> if (!ret) > >> - ret = fsnotify_mmap_perm(file, prot, pgoff >> PAGE_SHIFT, len); > >> + ret = fsnotify_mmap_perm(file, prot, off, len); > >> if (!ret) { > >> if (mmap_write_lock_killable(mm)) > >> return -EINTR; > >> -- > >> 2.43.0 > >> > -- Jan Kara SUSE Labs, CR From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id 8BiEBIPa42g91TYAYBR5ng (envelope-from ) for ; Mon, 06 Oct 2025 15:04:35 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 06 Oct 2025 15:04:35 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v5mlO-0000000HZiC-3Pqw for hi@josie.lol; Mon, 06 Oct 2025 15:04:35 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 9E22E4E0EC8 for ; Mon, 6 Oct 2025 15:04:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 78EE627A12B; Mon, 6 Oct 2025 15:04:29 +0000 (UTC) X-Original-To: stable@vger.kernel.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9645819F115; Mon, 6 Oct 2025 15:04:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759763069; cv=none; b=reRI2zs4S4gF3TmLZf4PmtSbJcigKjrknpbyRdFb2kfSD2F8MKVduNROZ87PccfpOY6PpLiy86a5wLL1E5VddUi3gHTU5oJQfce7dren/kpduv+NU1HBZEjOwj9fJRql9ciUjud9xrI+oxTDxMhC2sm68LUpxSzJKX3NPnnnFE8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759763069; c=relaxed/simple; bh=0B0iR2A3/3ULUTFpkpZyX/WPowk5NM3sAUJwWo0eieE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=UtJYdaU1diEDg9O8WD3tuSV+XTS3jLAT3+rabzpV32+ibI/c5dLe+YC8i7X9lDh6u6cGeQC6r0KO2qmOADVKrVAf7qDYBH/9rK9pfIwQnc9/1hblTeMuz8aUUcBOL5h7hT4rZn10kGj+UoFLgwCU2QBtcR8NQPJamtZc0xHJEzk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D19BB1515; Mon, 6 Oct 2025 08:04:18 -0700 (PDT) Received: from [10.57.81.160] (unknown [10.57.81.160]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F30893F66E; Mon, 6 Oct 2025 08:04:24 -0700 (PDT) Message-ID: Date: Mon, 6 Oct 2025 16:04:23 +0100 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1] fsnotify: Pass correct offset to fsnotify_mmap_perm() Content-Language: en-GB To: Jan Kara Cc: Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Amir Goldstein , linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20251003155238.2147410-1-ryan.roberts@arm.com> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 5 On 06/10/2025 15:55, Jan Kara wrote: > On Fri 03-10-25 16:52:36, Ryan Roberts wrote: >> fsnotify_mmap_perm() requires a byte offset for the file about to be >> mmap'ed. But it is called from vm_mmap_pgoff(), which has a page offset. >> Previously the conversion was done incorrectly so let's fix it, being >> careful not to overflow on 32-bit platforms. >> >> Discovered during code review. >> >> Cc: >> Fixes: 066e053fe208 ("fsnotify: add pre-content hooks on mmap()") >> Signed-off-by: Ryan Roberts >> --- >> Applies against today's mm-unstable (aa05a436eca8). > > Thanks Ryan! I've added the patch to my tree. As a side note, I know the > callsite is in mm/ but since this is clearly impacting fsnotify, it would > be good to add to CC relevant people (I'm not following linux-mm nor > linux-kernel) and discovered this only because of Kiryl's link... Ahh good point... Sorry I was sleepwalking through the process on Friday afternoon and blindly sent it to the maintainers and reviewers that get_maintainer.pl spat out. It didn't even occur to me that this wasn't an mm thing. :-| > > Honza > >> mm/util.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/mm/util.c b/mm/util.c >> index 6c1d64ed0221..8989d5767528 100644 >> --- a/mm/util.c >> +++ b/mm/util.c >> @@ -566,6 +566,7 @@ unsigned long vm_mmap_pgoff(struct file *file, unsigned long addr, >> unsigned long len, unsigned long prot, >> unsigned long flag, unsigned long pgoff) >> { >> + loff_t off = (loff_t)pgoff << PAGE_SHIFT; >> unsigned long ret; >> struct mm_struct *mm = current->mm; >> unsigned long populate; >> @@ -573,7 +574,7 @@ unsigned long vm_mmap_pgoff(struct file *file, unsigned long addr, >> >> ret = security_mmap_file(file, prot, flag); >> if (!ret) >> - ret = fsnotify_mmap_perm(file, prot, pgoff >> PAGE_SHIFT, len); >> + ret = fsnotify_mmap_perm(file, prot, off, len); >> if (!ret) { >> if (mmap_write_lock_killable(mm)) >> return -EINTR; >> -- >> 2.43.0 >> From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id MJQ3MWjY42g91TYAYBR5ng (envelope-from ) for ; Mon, 06 Oct 2025 14:55:36 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 06 Oct 2025 14:55:36 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v5mci-0000000HGEF-2Is9 for hi@josie.lol; Mon, 06 Oct 2025 14:55:36 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 65A824EEEC2 for ; Mon, 6 Oct 2025 14:55:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 322442D641F; Mon, 6 Oct 2025 14:55:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="2aMSnF0v"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="M5eZAvfL"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="2aMSnF0v"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="M5eZAvfL" X-Original-To: stable@vger.kernel.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 312782D5C97 for ; Mon, 6 Oct 2025 14:55:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759762525; cv=none; b=le+FAmoLUYONtUqyUvV7OIEYOUaKoZO9Sq6ZJXdM5HkUe4z6uEawmTKHwAr/bmWFUnjywkpx9AzsMuahoaICVRjB+Pv8Uuzj6+r2NFNoGwGzhXk72pHiVKgGmaWjE1wV5ahc0OhWFJDdeQZ3nwTTMDt2/gB3DRGXixpFRBOn3O8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759762525; c=relaxed/simple; bh=w+cd5BeBhK7+SgKfhDfuS2FPWZ8nSANcTGLN9fpYGI8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=eK8Pj///q9zRXrcZ4gEyXHdJTrVeYDTMa/CGJPSUvAnZFI0Ak7bfpSm5Lhdz8EREs3ZaWdrm/ZIQCzU1o5WhxYTmzdNdqLqpZ5cvRZzTq3/jYA3kfh4X/hE0Q0ghl/PT+Z4eorVMqes5GMIW7V4IAW0w5fthxQYuJh6w5nEtVsM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=2aMSnF0v; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=M5eZAvfL; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=2aMSnF0v; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=M5eZAvfL; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 179442227F; Mon, 6 Oct 2025 14:55:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1759762519; h=from:from:reply-to: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=4fqqFaLRqApP2CnNxjsITNJnHLiuJAc6kIlab9Tf0uA=; b=2aMSnF0vFaUTQlRjBeQC73mAUaJTiKhdaESayJJ7YIWh5slZz+JplwjOH9AQcRWxItehy9 q/JF7THrUN1SgjARnPr79+jlwXqYvCA9XWXB7azw4seXgLKhauwx3vrJGbVNhCGR1uIZ0L Z20kEFq43f6quNgNrSVGvKEXbBxG24k= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1759762519; h=from:from:reply-to: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=4fqqFaLRqApP2CnNxjsITNJnHLiuJAc6kIlab9Tf0uA=; b=M5eZAvfLOdBG4iQO2ffuDrnOH69ngkkcpu7+bOKxVaJMVvSED9zYyCAoDDkHJ6gOqsbKEL NGcUGsk6NFbu4YCA== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=2aMSnF0v; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=M5eZAvfL DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1759762519; h=from:from:reply-to: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=4fqqFaLRqApP2CnNxjsITNJnHLiuJAc6kIlab9Tf0uA=; b=2aMSnF0vFaUTQlRjBeQC73mAUaJTiKhdaESayJJ7YIWh5slZz+JplwjOH9AQcRWxItehy9 q/JF7THrUN1SgjARnPr79+jlwXqYvCA9XWXB7azw4seXgLKhauwx3vrJGbVNhCGR1uIZ0L Z20kEFq43f6quNgNrSVGvKEXbBxG24k= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1759762519; h=from:from:reply-to: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=4fqqFaLRqApP2CnNxjsITNJnHLiuJAc6kIlab9Tf0uA=; b=M5eZAvfLOdBG4iQO2ffuDrnOH69ngkkcpu7+bOKxVaJMVvSED9zYyCAoDDkHJ6gOqsbKEL NGcUGsk6NFbu4YCA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id F173013995; Mon, 6 Oct 2025 14:55:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id pQnvOlbY42jVJQAAD6G6ig (envelope-from ); Mon, 06 Oct 2025 14:55:18 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 8A3EAA0ABF; Mon, 6 Oct 2025 16:55:14 +0200 (CEST) Date: Mon, 6 Oct 2025 16:55:14 +0200 From: Jan Kara To: Ryan Roberts Cc: Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Amir Goldstein , linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v1] fsnotify: Pass correct offset to fsnotify_mmap_perm() Message-ID: References: <20251003155238.2147410-1-ryan.roberts@arm.com> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251003155238.2147410-1-ryan.roberts@arm.com> X-Spamd-Result: default: False [-4.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_NOT_FQDN(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; RCVD_COUNT_THREE(0.00)[3]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCPT_COUNT_TWELVE(0.00)[13]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_SOME(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_TLS_LAST(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; MISSING_XM_UA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FREEMAIL_CC(0.00)[linux-foundation.org,redhat.com,oracle.com,suse.cz,kernel.org,google.com,suse.com,gmail.com,kvack.org,vger.kernel.org]; DKIM_TRACE(0.00)[suse.cz:+]; DBL_BLOCKED_OPENRESOLVER(0.00)[arm.com:email,suse.com:email,suse.cz:dkim,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns] X-Spam-Flag: NO X-Spam-Level: X-Rspamd-Queue-Id: 179442227F X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spam-Score: -4.01 X-DKIM: signer='suse.cz' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in sa-trusted.bondedsender.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On Fri 03-10-25 16:52:36, Ryan Roberts wrote: > fsnotify_mmap_perm() requires a byte offset for the file about to be > mmap'ed. But it is called from vm_mmap_pgoff(), which has a page offset. > Previously the conversion was done incorrectly so let's fix it, being > careful not to overflow on 32-bit platforms. > > Discovered during code review. > > Cc: > Fixes: 066e053fe208 ("fsnotify: add pre-content hooks on mmap()") > Signed-off-by: Ryan Roberts > --- > Applies against today's mm-unstable (aa05a436eca8). Thanks Ryan! I've added the patch to my tree. As a side note, I know the callsite is in mm/ but since this is clearly impacting fsnotify, it would be good to add to CC relevant people (I'm not following linux-mm nor linux-kernel) and discovered this only because of Kiryl's link... Honza > mm/util.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/mm/util.c b/mm/util.c > index 6c1d64ed0221..8989d5767528 100644 > --- a/mm/util.c > +++ b/mm/util.c > @@ -566,6 +566,7 @@ unsigned long vm_mmap_pgoff(struct file *file, unsigned long addr, > unsigned long len, unsigned long prot, > unsigned long flag, unsigned long pgoff) > { > + loff_t off = (loff_t)pgoff << PAGE_SHIFT; > unsigned long ret; > struct mm_struct *mm = current->mm; > unsigned long populate; > @@ -573,7 +574,7 @@ unsigned long vm_mmap_pgoff(struct file *file, unsigned long addr, > > ret = security_mmap_file(file, prot, flag); > if (!ret) > - ret = fsnotify_mmap_perm(file, prot, pgoff >> PAGE_SHIFT, len); > + ret = fsnotify_mmap_perm(file, prot, off, len); > if (!ret) { > if (mmap_write_lock_killable(mm)) > return -EINTR; > -- > 2.43.0 > -- Jan Kara SUSE Labs, CR From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id 6C/2N9TU42gKTDcAYBR5ng (envelope-from ) for ; Mon, 06 Oct 2025 14:40:20 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 06 Oct 2025 14:40:20 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v5mNw-0000000Gg7u-30mD for hi@josie.lol; Mon, 06 Oct 2025 14:40:20 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id C72324E2B5C for ; Mon, 6 Oct 2025 14:40:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A14C42D47E8; Mon, 6 Oct 2025 14:40:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="im4Ifywn" X-Original-To: stable@vger.kernel.org Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD040283FD4 for ; Mon, 6 Oct 2025 14:40:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759761616; cv=none; b=Csovosbfk42CYrAMOBOJq01Zj062Ew2AP5CMe/T/52Pgzkjo7W3jvnn6CK5lSSztA/oHFZRNRYi5DPA9Zdn4EuS9cKqhHD+bC1OkM6kZQr9zZmbKvVXEivoazZ44cKMO3f50vcx0OGAqdQrGLzLM7iQBbrvyJPM45doRg42Mtdk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759761616; c=relaxed/simple; bh=EkR1H7X+TDjtCRI9KWYEwXGW5NBq3MyXaQ39Dh/nn3M=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=bzzDfUPhqtLUzimOz30NGVrkEGN6C1qOqJq1VuGWAfQ+ZV6oPqGtruGzGn/qfxy7dDtuyyQ4jXkexBPTFueWXANtUsJn2VZzJxuEyNG2/VbltPfMRKjuf1y4GGNzlceCRyuUtjX1eaemgTPieNWHmidYeLv5FFdSdUQD5lDF94E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=im4Ifywn; arc=none smtp.client-ip=209.85.208.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-63163a6556bso11141097a12.1 for ; Mon, 06 Oct 2025 07:40:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759761613; x=1760366413; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=EkR1H7X+TDjtCRI9KWYEwXGW5NBq3MyXaQ39Dh/nn3M=; b=im4IfywnSfxkP83dl8psGq2Rk2Z21zYb4jvP9nKF9vr9f3Nn2L6JqohFlgdCpyT4ui SNFRCjB8yvFMI7CGKmJrS/VXB1bWBqMIfcJZvFZa4qnDartVwNwBa4dvznfG7eOUJ1HF G2e2ITptWjR30EYsV02Yg1H2TFrHGR8XbQi4bC9NxRJveiRU75yQl8kSw1uObnrbT0gL l3FSe1dS2uheXAxUp25AiVvk5wG/pXZVqk6Rk14JRX9GSF9Uy4mN4pSI+oWS04AF5HJ4 orYYatd8sXLkae2RL6M3y4FiUyhBU8oM39Kgc71VZqj5Hxpph6tb0+CvSu/njymjp636 yNTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759761613; x=1760366413; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EkR1H7X+TDjtCRI9KWYEwXGW5NBq3MyXaQ39Dh/nn3M=; b=umrlu2m5JsKRHR5nGFqAQkutfgGoRQG4NxrqOiUzMka7H0nFc3UOQW2xn2DanHbkH2 ubOsuGVrQIZr9DVgT2zXIoPYPblA9xkHyo29oC2y2jp+39cHW8xduQXC5geskeaExSzw 3yONGjRPv2Ut6M8MDSUxQosPfQyx2eWtEcxLtH2rNXhJBH+hbwkpjB8XBZG8eCKkBmhm atKqwMZqLM7t1Oed9GdSts71XDlKtAP+DJj5hs7tPZHaN0OZf9IppPNT6l2o3MQ9bS7v uN7TCdQGFvk56jkb0KqJ56bfYUWeRJUp59KXd0ZYYruWPlPJ35x5+cIPzJL0E6yYixmS SkNA== X-Forwarded-Encrypted: i=1; AJvYcCXTyDJzAhVycScvzr9RUKbRe9d3lG3Yz5NL/v0lYP51fealSNQmHdbIHHcITryvObywRJhxwJE=@vger.kernel.org X-Gm-Message-State: AOJu0YylyZOjOSJXxVoEVAGS2JJBB2iuyv/+5pYv0IVKXw/mJefxh7jg QYK8D4kynfpI0vR2T0qKeq2je2Fx7WUrlLS7USrD/ssCmv7dKZY0OkAaUA9WZz99W8iEHNWCBg5 qAYd9b88jFf6zWYtCWB+su3AhMPFqF9w= X-Gm-Gg: ASbGnctHNss3v2LuE7NdKkSHQ6Q4Gu4/xIX+gaPGa0ZAG3WMCCyQ79pBwL23Fk2bvK7 7kINBj2tkZWi8jPSxuJa9s9QcbZeHPiRl+c4yWXMS1g4vIF1TlL0A0oBwN3CS6IF7kCIZKkcKCU 5G9TTiPMAsN4+TXA2jF1nctfrQEDlUnwaYzr+CFKIdF+oLpW0e62esrOTV/+RfsP20Uz6+/WJCO PHQ2Jic/MxpM+x67FkTsUmsnahf944qd8ZVAWBiE3OxtfLirmsHIfUYWN8kKik41PnrcVY1tclF X-Google-Smtp-Source: AGHT+IG7l9FcW7nFH5wcnGqf94SKHFIJbD02eMTFgXIso7ems2/RZwPOGR76iL5Jz5L+CD+kbTGEfLyCiPawWH7oe0s= X-Received: by 2002:a05:6402:520e:b0:634:8c41:c299 with SMTP id 4fb4d7f45d1cf-6393491e788mr15011143a12.19.1759761612739; Mon, 06 Oct 2025 07:40:12 -0700 (PDT) Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20251003155238.2147410-1-ryan.roberts@arm.com> <66251c3e-4970-4cac-a1fc-46749d2a727a@arm.com> <989c49fc-1f6f-4674-96e7-9f987ec490db@redhat.com> In-Reply-To: <989c49fc-1f6f-4674-96e7-9f987ec490db@redhat.com> From: Amir Goldstein Date: Mon, 6 Oct 2025 16:40:00 +0200 X-Gm-Features: AS18NWBuQFyxsQau3P8JL_AyINiEL_Ybt3_UNKcM6OGOrGzarzlxxcIDC21sR04 Message-ID: Subject: Re: [PATCH v1] fsnotify: Pass correct offset to fsnotify_mmap_perm() To: David Hildenbrand Cc: Ryan Roberts , Andrew Morton , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Jan Kara Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in bl.score.senderscore.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [amir73il[at]gmail.com] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On Mon, Oct 6, 2025 at 3:53=E2=80=AFPM David Hildenbrand = wrote: > > On 06.10.25 14:14, Ryan Roberts wrote: > > On 06/10/2025 12:36, David Hildenbrand wrote: > >> On 03.10.25 17:52, Ryan Roberts wrote: > >>> fsnotify_mmap_perm() requires a byte offset for the file about to be > >>> mmap'ed. But it is called from vm_mmap_pgoff(), which has a page offs= et. > >>> Previously the conversion was done incorrectly so let's fix it, being > >>> careful not to overflow on 32-bit platforms. > >>> > >>> Discovered during code review. > >>> > >>> Cc: > >>> Fixes: 066e053fe208 ("fsnotify: add pre-content hooks on mmap()") > >>> Signed-off-by: Ryan Roberts > >>> --- > >>> Applies against today's mm-unstable (aa05a436eca8). > >>> > >> > >> Curious: is there some easy way to write a reproducer? Did you look in= to that? > > > > I didn't; this was just a drive-by discovery. > > > > It looks like there are some fanotify tests in the filesystems selftest= s; I > > guess they could be extended to add a regression test? > > > > But FWIW, I think the kernel is just passing the ofset/length info off = to user > > space and isn't acting on it itself. So there is no kernel vulnerabilit= y here. > > Right, I'm rather wondering if this could have been caught earlier and > how we could have caught it earlier :) Ha! you would have thought we either have no test for it or we test only mmap with offset 0. But we have LTP test fanotify24 which does mmap with offset page_sz*100 and indeed it prints the info and info says offset 0, only we do not verify= the offset info in this test... Will be fixed. Thanks Ryan for being alert! Amir. From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id UOFqLPjJ42gHhzYAYBR5ng (envelope-from ) for ; Mon, 06 Oct 2025 13:54:00 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 06 Oct 2025 13:54:00 +0000 Received: from ams.mirrors.kernel.org ([213.196.21.55]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v5lf6-0000000F0Uy-1dB5 for hi@josie.lol; Mon, 06 Oct 2025 13:54:00 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.mirrors.kernel.org (Postfix) with ESMTPS id EDD1B341F40 for ; Mon, 6 Oct 2025 13:53:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1121D2D29DB; Mon, 6 Oct 2025 13:53:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="c95OTyAd" X-Original-To: stable@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 4767D27F19F for ; Mon, 6 Oct 2025 13:53:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759758835; cv=none; b=vBw1os2Nbtv/X2Llq60/JAG+aDy0ssIsImkrAY8N9+biHR/Dpg1C9HAk/cNSTJam0zStfgrLpC4hVTr99lJq0XUaIiK9IwlbrnsjYjUmDkYIRid8M43pjgz3Bqwn0ag1kGB3Ns5HgE8xQhXCLfiPf9YnbQytegCltjGuGK6qpvo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759758835; c=relaxed/simple; bh=NzuZ2WimXZhzKfuoxT422QsjdAD7EiCbAZGkcz1OTCM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=L5S0EjiHAbXgfV0HgqMHZZwMfFllt1OYMGoVk9seRwj2wAkR2VWQxfxCf1cLYZNPBus5GXU2hf55RGM4DQI8vBMENCTguSrni3OKS0pRWJ9LdMMjC15CcL4AY/FtoH9CqV1e2nA05HHkn/5OBLoY4T40Lv/h6oiGMJHYYa7PXYU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=c95OTyAd; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1759758832; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=CGLl7ctOpTpoDpfWPZR3DaFESuMtpId6EeCDbxcp3bo=; b=c95OTyAdTyKLW9mGELgTCZizZ8Fwo8ORNBontJgvsNdQsLQUZbvhz4DUSzlQnKs/Se+zbm AP/+qu3fN6xfOgBbdUbSVQUds+/CYKrrIAp5+Og9A3m1e1xxqq5dOTH6RUplixE0DQf60p CZxPPQdtWa6/uY7OThbkqJPhZ8gjpnM= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-191-itHrmwYnN6uCpkkssTfTwA-1; Mon, 06 Oct 2025 09:53:50 -0400 X-MC-Unique: itHrmwYnN6uCpkkssTfTwA-1 X-Mimecast-MFC-AGG-ID: itHrmwYnN6uCpkkssTfTwA_1759758830 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-3f4fbdf144dso2680931f8f.2 for ; Mon, 06 Oct 2025 06:53:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759758830; x=1760363630; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=CGLl7ctOpTpoDpfWPZR3DaFESuMtpId6EeCDbxcp3bo=; b=qYvTGLKGQXmKAkzFspn60sWUrsNLoktjmHHVcrDbbQ8lGBbqq8vNYhd/sVf2ZJhpu0 yDy9Jgmk00H7Mrcsc6A0GtnE4bLncba45drRSHjfZuDVR+Og1eSX/3XDrLcRlWY5Wcuk kGDfGpuaauTXxdkKeqDGMAe6+cITlA5IQx3OXecdYNpat70tOw3jg277vKuMkqAaTV/w M94I8/aBzCnDDOFKhHzr0qO7YtZ4ks5tUuf4eYiHQ6LOvY3ZPbNakz0Rx2QRamrreBmc yS/njPgdUuULOAtWWD21DhicjsTrp0SDHTBmLAR8k3AmcW9Qd2F/b1YOdSD2A8jpEDWC IzGg== X-Forwarded-Encrypted: i=1; AJvYcCXxtUOMzhMLDp6ny0XZ6t1SoIr4b51GrB4oUVv2osYk7TidPvyUnqFWeqqzldpX/sc6EN0D1uI=@vger.kernel.org X-Gm-Message-State: AOJu0YzXRYNnOo9cTmCPu3Zt7vDBrMcpXBeL9FcxwxpjxZiy/cHmMr8O qR8ufHaEiLBNjnQXAm/XM/ebzgHHsPMRn7LQyMQtWxD4NTWWCtYL++66PSZW+kHTFG9vwVVyd51 0gdOYg+FekbmDpzVZonSVADSybnuuCK2f9/fQQ8ls1mR2D2rCB3ErSSPf4g== X-Gm-Gg: ASbGncu2wOKezkz/95d43lYeXxpElPhzReQXD4AxROiYy/ZdFKYy/FF5Nqq5o7eVVMT rC1pHE1w3REpexkOuk3MXzpWbL3RxM922OHjT86I7J5FNkscNMVdXLC/EoX94HYcsHzCDE1AkCC WPjSv0qiqhgdqVYcBG2yhiykDK0aHboe/yjLuYwHdvb1qmCZ4vSlx/pycVWXDKT8HE9kg/KZEsO qGtkfi/l6EIfzP7/33/MSF75aFzl7ex343iSu6qdiaGoXAEyQ1HmS15NW8SW32jHwOAyjz3BmFb Jpm2ZzNQ3s0FHb75QMvUtvGassRI2VaSeJ+FMNIYxmufmr9l2Dp9fvs9bxxjvIELkrt8OSdOH7V AQ/Xi+pIS X-Received: by 2002:a5d:5885:0:b0:3cd:edee:c7f1 with SMTP id ffacd0b85a97d-425671aa965mr9519903f8f.56.1759758829619; Mon, 06 Oct 2025 06:53:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG4z3VUwSp6NiPOhxjtLfmmF5LdjV37JJ4DT2V+xwJ/f0irliRMICXktxy6TvXFLIvLoD96wQ== X-Received: by 2002:a5d:5885:0:b0:3cd:edee:c7f1 with SMTP id ffacd0b85a97d-425671aa965mr9519876f8f.56.1759758829047; Mon, 06 Oct 2025 06:53:49 -0700 (PDT) Received: from [192.168.3.141] (tmo-083-110.customers.d1-online.com. [80.187.83.110]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4255d8e980dsm22658378f8f.36.2025.10.06.06.53.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 Oct 2025 06:53:48 -0700 (PDT) Message-ID: <989c49fc-1f6f-4674-96e7-9f987ec490db@redhat.com> Date: Mon, 6 Oct 2025 15:53:46 +0200 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1] fsnotify: Pass correct offset to fsnotify_mmap_perm() To: Ryan Roberts , Andrew Morton , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Amir Goldstein Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20251003155238.2147410-1-ryan.roberts@arm.com> <66251c3e-4970-4cac-a1fc-46749d2a727a@arm.com> From: David Hildenbrand Content-Language: en-US Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9 PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk ZW5icmFuZCA8ZGF2aWRAcmVkaGF0LmNvbT7CwZoEEwEIAEQCGwMCF4ACGQEFCwkIBwICIgIG FQoJCAsCBBYCAwECHgcWIQQb2cqtc1xMOkYN/MpN3hD3AP+DWgUCaJzangUJJlgIpAAKCRBN 3hD3AP+DWhAxD/9wcL0A+2rtaAmutaKTfxhTP0b4AAp1r/eLxjrbfbCCmh4pqzBhmSX/4z11 opn2KqcOsueRF1t2ENLOWzQu3Roiny2HOU7DajqB4dm1BVMaXQya5ae2ghzlJN9SIoopTWlR 0Af3hPj5E2PYvQhlcqeoehKlBo9rROJv/rjmr2x0yOM8qeTroH/ZzNlCtJ56AsE6Tvl+r7cW 3x7/Jq5WvWeudKrhFh7/yQ7eRvHCjd9bBrZTlgAfiHmX9AnCCPRPpNGNedV9Yty2Jnxhfmbv Pw37LA/jef8zlCDyUh2KCU1xVEOWqg15o1RtTyGV1nXV2O/mfuQJud5vIgzBvHhypc3p6VZJ lEf8YmT+Ol5P7SfCs5/uGdWUYQEMqOlg6w9R4Pe8d+mk8KGvfE9/zTwGg0nRgKqlQXrWRERv cuEwQbridlPAoQHrFWtwpgYMXx2TaZ3sihcIPo9uU5eBs0rf4mOERY75SK+Ekayv2ucTfjxr Kf014py2aoRJHuvy85ee/zIyLmve5hngZTTe3Wg3TInT9UTFzTPhItam6dZ1xqdTGHZYGU0O otRHcwLGt470grdiob6PfVTXoHlBvkWRadMhSuG4RORCDpq89vu5QralFNIf3EysNohoFy2A LYg2/D53xbU/aa4DDzBb5b1Rkg/udO1gZocVQWrDh6I2K3+cCs7BTQRVy5+RARAA59fefSDR 9nMGCb9LbMX+TFAoIQo/wgP5XPyzLYakO+94GrgfZjfhdaxPXMsl2+o8jhp/hlIzG56taNdt VZtPp3ih1AgbR8rHgXw1xwOpuAd5lE1qNd54ndHuADO9a9A0vPimIes78Hi1/yy+ZEEvRkHk /kDa6F3AtTc1m4rbbOk2fiKzzsE9YXweFjQvl9p+AMw6qd/iC4lUk9g0+FQXNdRs+o4o6Qvy iOQJfGQ4UcBuOy1IrkJrd8qq5jet1fcM2j4QvsW8CLDWZS1L7kZ5gT5EycMKxUWb8LuRjxzZ 3QY1aQH2kkzn6acigU3HLtgFyV1gBNV44ehjgvJpRY2cC8VhanTx0dZ9mj1YKIky5N+C0f21 zvntBqcxV0+3p8MrxRRcgEtDZNav+xAoT3G0W4SahAaUTWXpsZoOecwtxi74CyneQNPTDjNg azHmvpdBVEfj7k3p4dmJp5i0U66Onmf6mMFpArvBRSMOKU9DlAzMi4IvhiNWjKVaIE2Se9BY FdKVAJaZq85P2y20ZBd08ILnKcj7XKZkLU5FkoA0udEBvQ0f9QLNyyy3DZMCQWcwRuj1m73D sq8DEFBdZ5eEkj1dCyx+t/ga6x2rHyc8Sl86oK1tvAkwBNsfKou3v+jP/l14a7DGBvrmlYjO 59o3t6inu6H7pt7OL6u6BQj7DoMAEQEAAcLBfAQYAQgAJgIbDBYhBBvZyq1zXEw6Rg38yk3e EPcA/4NaBQJonNqrBQkmWAihAAoJEE3eEPcA/4NaKtMQALAJ8PzprBEXbXcEXwDKQu+P/vts IfUb1UNMfMV76BicGa5NCZnJNQASDP/+bFg6O3gx5NbhHHPeaWz/VxlOmYHokHodOvtL0WCC 8A5PEP8tOk6029Z+J+xUcMrJClNVFpzVvOpb1lCbhjwAV465Hy+NUSbbUiRxdzNQtLtgZzOV Zw7jxUCs4UUZLQTCuBpFgb15bBxYZ/BL9MbzxPxvfUQIPbnzQMcqtpUs21CMK2PdfCh5c4gS sDci6D5/ZIBw94UQWmGpM/O1ilGXde2ZzzGYl64glmccD8e87OnEgKnH3FbnJnT4iJchtSvx yJNi1+t0+qDti4m88+/9IuPqCKb6Stl+s2dnLtJNrjXBGJtsQG/sRpqsJz5x1/2nPJSRMsx9 5YfqbdrJSOFXDzZ8/r82HgQEtUvlSXNaXCa95ez0UkOG7+bDm2b3s0XahBQeLVCH0mw3RAQg r7xDAYKIrAwfHHmMTnBQDPJwVqxJjVNr7yBic4yfzVWGCGNE4DnOW0vcIeoyhy9vnIa3w1uZ 3iyY2Nsd7JxfKu1PRhCGwXzRw5TlfEsoRI7V9A8isUCoqE2Dzh3FvYHVeX4Us+bRL/oqareJ CIFqgYMyvHj7Q06kTKmauOe4Nf0l0qEkIuIzfoLJ3qr5UyXc2hLtWyT9Ir+lYlX9efqh7mOY qIws/H2t In-Reply-To: <66251c3e-4970-4cac-a1fc-46749d2a727a@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-DKIM: signer='redhat.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -0.0 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-0.0 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [213.196.21.55 listed in sa-accredit.habeas.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [213.196.21.55 listed in bl.score.senderscore.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [213.196.21.55 listed in list.dnswl.org] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.4 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: 0 On 06.10.25 14:14, Ryan Roberts wrote: > On 06/10/2025 12:36, David Hildenbrand wrote: >> On 03.10.25 17:52, Ryan Roberts wrote: >>> fsnotify_mmap_perm() requires a byte offset for the file about to be >>> mmap'ed. But it is called from vm_mmap_pgoff(), which has a page offset. >>> Previously the conversion was done incorrectly so let's fix it, being >>> careful not to overflow on 32-bit platforms. >>> >>> Discovered during code review. >>> >>> Cc: >>> Fixes: 066e053fe208 ("fsnotify: add pre-content hooks on mmap()") >>> Signed-off-by: Ryan Roberts >>> --- >>> Applies against today's mm-unstable (aa05a436eca8). >>> >> >> Curious: is there some easy way to write a reproducer? Did you look into that? > > I didn't; this was just a drive-by discovery. > > It looks like there are some fanotify tests in the filesystems selftests; I > guess they could be extended to add a regression test? > > But FWIW, I think the kernel is just passing the ofset/length info off to user > space and isn't acting on it itself. So there is no kernel vulnerability here. Right, I'm rather wondering if this could have been caught earlier and how we could have caught it earlier :) -- Cheers David / dhildenb From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id GDdvGZay42im/SYAYBR5ng (envelope-from ) for ; Mon, 06 Oct 2025 12:14:14 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 06 Oct 2025 12:14:14 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v5k6X-0000000BS4I-3yyN for hi@josie.lol; Mon, 06 Oct 2025 12:14:14 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 13C2D4E522A for ; Mon, 6 Oct 2025 12:14:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E4FC2226CF0; Mon, 6 Oct 2025 12:14:10 +0000 (UTC) X-Original-To: stable@vger.kernel.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D9149269CF1; Mon, 6 Oct 2025 12:14:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759752850; cv=none; b=KG2zJOP2u+92hB5mQ4YaOcgVOSdnjjMag2qG49uanMOkS4QjRcaF5zT4phqt0Jq6nmpK4AgaIYhTOtUWBBsdvZRIoYx5ESLpGMXAvY76ITSs0MY4Eu+ekHVyDd8atPcF3W64UotXeC6U2UvkBekwKc4dntU7r3KOPbqkWIUuOYU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759752850; c=relaxed/simple; bh=YK4niNdQaM3H/jhjLOvTw+T2AmFLkKWKRBPumt1Nd1Q=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=fQPl/1DrHW6MGmXNOssJqrjd4b/Wwy/CCzopoikqxBdpJXrbTVvXtIo1phZWgmbEU6kOZqHKCHM4ZsRwBzlDuSsnR6HqZsqJ9dI5vgDCk6aul8E/ioLUuR9epfeti8GNVLDJbMaP8jWRx722VNgs5TpONC1alYM5Bdw98F4iBA8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A7B9A1515; Mon, 6 Oct 2025 05:13:57 -0700 (PDT) Received: from [10.57.81.160] (unknown [10.57.81.160]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0AAD73F738; Mon, 6 Oct 2025 05:14:03 -0700 (PDT) Message-ID: <66251c3e-4970-4cac-a1fc-46749d2a727a@arm.com> Date: Mon, 6 Oct 2025 13:14:02 +0100 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1] fsnotify: Pass correct offset to fsnotify_mmap_perm() Content-Language: en-GB To: David Hildenbrand , Andrew Morton , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Amir Goldstein Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20251003155238.2147410-1-ryan.roberts@arm.com> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in bl.score.senderscore.com] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 5 On 06/10/2025 12:36, David Hildenbrand wrote: > On 03.10.25 17:52, Ryan Roberts wrote: >> fsnotify_mmap_perm() requires a byte offset for the file about to be >> mmap'ed. But it is called from vm_mmap_pgoff(), which has a page offset. >> Previously the conversion was done incorrectly so let's fix it, being >> careful not to overflow on 32-bit platforms. >> >> Discovered during code review. >> >> Cc: >> Fixes: 066e053fe208 ("fsnotify: add pre-content hooks on mmap()") >> Signed-off-by: Ryan Roberts >> --- >> Applies against today's mm-unstable (aa05a436eca8). >> > > Curious: is there some easy way to write a reproducer? Did you look into that? I didn't; this was just a drive-by discovery. It looks like there are some fanotify tests in the filesystems selftests; I guess they could be extended to add a regression test? But FWIW, I think the kernel is just passing the ofset/length info off to user space and isn't acting on it itself. So there is no kernel vulnerability here. > > LGTM, thanks > > Acked-by: David Hildenbrand > From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id oJg3NdKp42jr6SMAYBR5ng (envelope-from ) for ; Mon, 06 Oct 2025 11:36:50 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 06 Oct 2025 11:36:50 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v5jWM-0000000A8EQ-2sAZ for hi@josie.lol; Mon, 06 Oct 2025 11:36:50 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 9BB334E4D46 for ; Mon, 6 Oct 2025 11:36:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 12662269AEE; Mon, 6 Oct 2025 11:36:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ZBW2G1ur" X-Original-To: stable@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 43C8F26158C for ; Mon, 6 Oct 2025 11:36:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759750608; cv=none; b=pCrBed1QimOr4DYS40rGmloZCkQBFzmAPqmNA/ErGbahNuBvyqWf/lRphNm5Fit0Pq3TukzfX/LdA0NzMY08kKWI3HrSRrM+vGWVu1piuLyNwnrdkHZvs0Hyvr9LjIe6a978UgFIUU269e3dRRifblGC/Ve1IH8DDgR9MW8SbU0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759750608; c=relaxed/simple; bh=jgFmOZy99XKs4DXZwQeTOTDa/EuMGBOdSdGACbwRi6M=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=rejXGOUmIXkAWe9Z+JC7XHTJt1tW0z5D9i631E5YgbklkhhMdHVOWwgJ6/MC/mgqxd9won3dyJ+ZhVmjsbrB1xdCGRH7yK0RhdVxFZLRQFa7BH0jyUq2UYo2vi0Pd8rrtjQF0tmhi0Btg6BmmefHNO1UBtez2fWchsm0EGjD1fQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ZBW2G1ur; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1759750605; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=vHN3zB+N3cficB6+biNHEOHdUuG5loOtVKEpUTZFgh4=; b=ZBW2G1ur8tF9kzMGrnTy/+s03hSDUY+yUPHR8q5yZmP2nFR74+iFmuZXOqsZyL/Ackn8Kq nsQq4LxXCqzAzdgw9KWwh5FxLWb9oHeFh35LlnwTTXnCqiIvZGrwpqAFHEZ2EnIsLTmLc/ OgVVhlrbANOOwGiZrLSqMDD5cspw5cY= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-693-DdSimhb6ONWvJFF6aZnjsQ-1; Mon, 06 Oct 2025 07:36:44 -0400 X-MC-Unique: DdSimhb6ONWvJFF6aZnjsQ-1 X-Mimecast-MFC-AGG-ID: DdSimhb6ONWvJFF6aZnjsQ_1759750603 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-4255d025f41so2900971f8f.1 for ; Mon, 06 Oct 2025 04:36:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759750603; x=1760355403; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vHN3zB+N3cficB6+biNHEOHdUuG5loOtVKEpUTZFgh4=; b=RwN0eMas9/5S4J+KT8M/6BotaKvH1Ze7uX5pmzeYFPR7xQP1vk6mSgUy8Tnrf4q/fL 3SY+yyjKhBazpKLxvZ55JqcNIrPgYEmsu19dr4jALTnYxhi2HqdN4WRlI+bJJIUQSt90 5jUUIIrFH0AT8pf6zipGj8a2eUm/21OuxLlpDxXwpkgPn4qfF75wE42YoeXoNbOn2X+K pdIdqX9Iyxu8aIBUc8q2Sj3qsHyDgj/nb67Xp5VktYn822Nt9sAUGagWABA84/17bKtU X8uVia9RsQe3skK2odCVvxRgsZBk8+IWCkTrI3inEjGKlNZqRdTgBSbjvtMsIQ6KfNmc nKGg== X-Forwarded-Encrypted: i=1; AJvYcCWSYSfsBZfMZAEIX8xm/XbN9mx0HT/3WuuZaSR5eDHYGT4RZVLzcv+7Qnqp/MMHuD/yuBduFkY=@vger.kernel.org X-Gm-Message-State: AOJu0YzjUgxRmCVyFwT9f6HjBHDD/qCggoi2xtDjxFnoocVLoLevAdVf u2SVybEGbTcMxRAdNAYr55Lh8NLhUT09xUq+7nk0Zv/5iBmmaNIqDCdsE1qUy4nUYtprYnEyENr ADj4hrw6CmOpaWUtHJEZLrBJgDw69XrsBA4Vj0ssWP5no6/ju5jJyJm/PIw== X-Gm-Gg: ASbGnctxXIm9zMfIX0CYUTCoqEl6MLPQS/q/wXaR3pUWaa7BzTw0aVFYe6AQjjunwzR 6Sf8KzeoEg6c6sDm08Im8n9NMdDCOMJptjiGQecIq/QLOPp8O64iXA9WezjvouoWVcTVkHHNdwl q5zE3E2qeadVNiShpirkYo8M265c2NNC9Wvo5usw9I3MNACXJZj4TPBnTB8vFIxvYuKkNulnXpX S+tBxwdFXSSmnU4EkWE40aRYw2E6x4Xs/x/PZ4Hj4klgce0bbE56n4Z0DfBRN8D2cRrWFAArWUN ETMpK2Su2OpXIGCApCO0mkd6sEUU5dh9z/z8q0WXyzMqymc4mi97jlFN6eqjizHWr+O6AYi7rpS EVGKaWhGH X-Received: by 2002:a5d:584b:0:b0:3ea:f4a1:f063 with SMTP id ffacd0b85a97d-425671c15f9mr7577062f8f.55.1759750602866; Mon, 06 Oct 2025 04:36:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH4fa1egcyF8r1G1AFUJgPykSWMK+76QilbNO7Gb4q43iQveNh0omx+isa8IIngfIMXEURqYw== X-Received: by 2002:a5d:584b:0:b0:3ea:f4a1:f063 with SMTP id ffacd0b85a97d-425671c15f9mr7577044f8f.55.1759750602454; Mon, 06 Oct 2025 04:36:42 -0700 (PDT) Received: from [192.168.3.141] (tmo-083-110.customers.d1-online.com. [80.187.83.110]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4255d8ab8fdsm20309038f8f.15.2025.10.06.04.36.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 Oct 2025 04:36:42 -0700 (PDT) Message-ID: Date: Mon, 6 Oct 2025 13:36:40 +0200 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1] fsnotify: Pass correct offset to fsnotify_mmap_perm() To: Ryan Roberts , Andrew Morton , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Amir Goldstein Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20251003155238.2147410-1-ryan.roberts@arm.com> From: David Hildenbrand Content-Language: en-US Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9 PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk ZW5icmFuZCA8ZGF2aWRAcmVkaGF0LmNvbT7CwZoEEwEIAEQCGwMCF4ACGQEFCwkIBwICIgIG FQoJCAsCBBYCAwECHgcWIQQb2cqtc1xMOkYN/MpN3hD3AP+DWgUCaJzangUJJlgIpAAKCRBN 3hD3AP+DWhAxD/9wcL0A+2rtaAmutaKTfxhTP0b4AAp1r/eLxjrbfbCCmh4pqzBhmSX/4z11 opn2KqcOsueRF1t2ENLOWzQu3Roiny2HOU7DajqB4dm1BVMaXQya5ae2ghzlJN9SIoopTWlR 0Af3hPj5E2PYvQhlcqeoehKlBo9rROJv/rjmr2x0yOM8qeTroH/ZzNlCtJ56AsE6Tvl+r7cW 3x7/Jq5WvWeudKrhFh7/yQ7eRvHCjd9bBrZTlgAfiHmX9AnCCPRPpNGNedV9Yty2Jnxhfmbv Pw37LA/jef8zlCDyUh2KCU1xVEOWqg15o1RtTyGV1nXV2O/mfuQJud5vIgzBvHhypc3p6VZJ lEf8YmT+Ol5P7SfCs5/uGdWUYQEMqOlg6w9R4Pe8d+mk8KGvfE9/zTwGg0nRgKqlQXrWRERv cuEwQbridlPAoQHrFWtwpgYMXx2TaZ3sihcIPo9uU5eBs0rf4mOERY75SK+Ekayv2ucTfjxr Kf014py2aoRJHuvy85ee/zIyLmve5hngZTTe3Wg3TInT9UTFzTPhItam6dZ1xqdTGHZYGU0O otRHcwLGt470grdiob6PfVTXoHlBvkWRadMhSuG4RORCDpq89vu5QralFNIf3EysNohoFy2A LYg2/D53xbU/aa4DDzBb5b1Rkg/udO1gZocVQWrDh6I2K3+cCs7BTQRVy5+RARAA59fefSDR 9nMGCb9LbMX+TFAoIQo/wgP5XPyzLYakO+94GrgfZjfhdaxPXMsl2+o8jhp/hlIzG56taNdt VZtPp3ih1AgbR8rHgXw1xwOpuAd5lE1qNd54ndHuADO9a9A0vPimIes78Hi1/yy+ZEEvRkHk /kDa6F3AtTc1m4rbbOk2fiKzzsE9YXweFjQvl9p+AMw6qd/iC4lUk9g0+FQXNdRs+o4o6Qvy iOQJfGQ4UcBuOy1IrkJrd8qq5jet1fcM2j4QvsW8CLDWZS1L7kZ5gT5EycMKxUWb8LuRjxzZ 3QY1aQH2kkzn6acigU3HLtgFyV1gBNV44ehjgvJpRY2cC8VhanTx0dZ9mj1YKIky5N+C0f21 zvntBqcxV0+3p8MrxRRcgEtDZNav+xAoT3G0W4SahAaUTWXpsZoOecwtxi74CyneQNPTDjNg azHmvpdBVEfj7k3p4dmJp5i0U66Onmf6mMFpArvBRSMOKU9DlAzMi4IvhiNWjKVaIE2Se9BY FdKVAJaZq85P2y20ZBd08ILnKcj7XKZkLU5FkoA0udEBvQ0f9QLNyyy3DZMCQWcwRuj1m73D sq8DEFBdZ5eEkj1dCyx+t/ga6x2rHyc8Sl86oK1tvAkwBNsfKou3v+jP/l14a7DGBvrmlYjO 59o3t6inu6H7pt7OL6u6BQj7DoMAEQEAAcLBfAQYAQgAJgIbDBYhBBvZyq1zXEw6Rg38yk3e EPcA/4NaBQJonNqrBQkmWAihAAoJEE3eEPcA/4NaKtMQALAJ8PzprBEXbXcEXwDKQu+P/vts IfUb1UNMfMV76BicGa5NCZnJNQASDP/+bFg6O3gx5NbhHHPeaWz/VxlOmYHokHodOvtL0WCC 8A5PEP8tOk6029Z+J+xUcMrJClNVFpzVvOpb1lCbhjwAV465Hy+NUSbbUiRxdzNQtLtgZzOV Zw7jxUCs4UUZLQTCuBpFgb15bBxYZ/BL9MbzxPxvfUQIPbnzQMcqtpUs21CMK2PdfCh5c4gS sDci6D5/ZIBw94UQWmGpM/O1ilGXde2ZzzGYl64glmccD8e87OnEgKnH3FbnJnT4iJchtSvx yJNi1+t0+qDti4m88+/9IuPqCKb6Stl+s2dnLtJNrjXBGJtsQG/sRpqsJz5x1/2nPJSRMsx9 5YfqbdrJSOFXDzZ8/r82HgQEtUvlSXNaXCa95ez0UkOG7+bDm2b3s0XahBQeLVCH0mw3RAQg r7xDAYKIrAwfHHmMTnBQDPJwVqxJjVNr7yBic4yfzVWGCGNE4DnOW0vcIeoyhy9vnIa3w1uZ 3iyY2Nsd7JxfKu1PRhCGwXzRw5TlfEsoRI7V9A8isUCoqE2Dzh3FvYHVeX4Us+bRL/oqareJ CIFqgYMyvHj7Q06kTKmauOe4Nf0l0qEkIuIzfoLJ3qr5UyXc2hLtWyT9Ir+lYlX9efqh7mOY qIws/H2t In-Reply-To: <20251003155238.2147410-1-ryan.roberts@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-DKIM: signer='redhat.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -0.0 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-0.0 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in sa-accredit.habeas.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.4 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: 0 On 03.10.25 17:52, Ryan Roberts wrote: > fsnotify_mmap_perm() requires a byte offset for the file about to be > mmap'ed. But it is called from vm_mmap_pgoff(), which has a page offset. > Previously the conversion was done incorrectly so let's fix it, being > careful not to overflow on 32-bit platforms. > > Discovered during code review. > > Cc: > Fixes: 066e053fe208 ("fsnotify: add pre-content hooks on mmap()") > Signed-off-by: Ryan Roberts > --- > Applies against today's mm-unstable (aa05a436eca8). > Curious: is there some easy way to write a reproducer? Did you look into that? LGTM, thanks Acked-by: David Hildenbrand -- Cheers David / dhildenb From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id qGW3Euz/32jhBSYAYBR5ng (envelope-from ) for ; Fri, 03 Oct 2025 16:55:08 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Fri, 03 Oct 2025 16:55:08 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v4j3k-0000000B8Fz-0GW1 for hi@josie.lol; Fri, 03 Oct 2025 16:55:08 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 125054EE467 for ; Fri, 3 Oct 2025 16:54:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2AC902D6621; Fri, 3 Oct 2025 16:54:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=shutemov.name header.i=@shutemov.name header.b="VrCAewWI"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="HJbP2dU1" X-Original-To: stable@vger.kernel.org Received: from fout-a5-smtp.messagingengine.com (fout-a5-smtp.messagingengine.com [103.168.172.148]) (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 EF5AC2D595F; Fri, 3 Oct 2025 16:54:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.148 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759510450; cv=none; b=qW4Hq4vpiWC3cuaE9o0DIKku8SZX2y2CcvuN2BFyJkFeLemNYK0s9KPxFXFkqvQikjatN7KY2dU7KoqKIfwGosBtDqCiRt5aUXJ3/Ric5aNboBlpp1r2j2EsQiP/9HinScnKXeciLJp4G8HxKsn2QaSDDmHivwT6MBi97jWToL0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759510450; c=relaxed/simple; bh=35W1zDtcABYboWRTHG7RpMOvL/GDkuxlmUL/WfSWIgQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RSQAkIH3ug2lR5bd0WT44QD/dJWa4+mtMNtHTo6BQz+tOsMKC8ozTeIyaET77qaXoAI+JqLbe9sIvttHItdnH/J4cCZI6WxG5LV1f3tKbh4LikOEGuDRq9edzwrPjNdunAdkZgz8zhijFLNajICpnvwKNnZ/dtxNlExm4CXuAG0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name; spf=pass smtp.mailfrom=shutemov.name; dkim=pass (2048-bit key) header.d=shutemov.name header.i=@shutemov.name header.b=VrCAewWI; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=HJbP2dU1; arc=none smtp.client-ip=103.168.172.148 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=shutemov.name Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id 12A22EC0278; Fri, 3 Oct 2025 12:54:07 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Fri, 03 Oct 2025 12:54:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov.name; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm3; t=1759510447; x= 1759596847; bh=UB3IKnHmzh/QmKgOFKGx8BLdmDHf57NxnecnD+p+sRM=; b=V rCAewWI7sbJvCIV/zpcnz6A0CPYZVWfFX0Dtm6UVGY6RT/28Zy15ntNNBSsAtIPl 4AeS0Pk+Ho+rYuDaaB5Hw8Klh46ivi7sHEvbAweBb3JCb/miDh0XneQcuqst6+iP DHK0uh+ii8tWQ/XnmCSykrps7XG21DgZeTLz9ukgJ1iOPBrHGnVuXlbxVeSYLsbZ cL13AnQ6Yg47zxCMlkQh0NMH4W2OUmvwFnwM0klqG7+4HdB4gezArrTeuYAxGz7V ME2GJ/yA/ViRO3iBOMsBiX8P2RbCtCRrrX2Qx4yOchMwc9QS9uxG0tWIxDzVxn0Q O8zpttlCxiJljP2WsmAzQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1759510447; x=1759596847; bh=UB3IKnHmzh/QmKgOFKGx8BLdmDHf57Nxnec nD+p+sRM=; b=HJbP2dU1gXqvJr5xZP81JrdPktlFylwZz2QyJKBRAemfB/Na89d 4uMVsS2+JGsNIkxPYS3qPWpObEW7BZQXNk4si7jgrgb9bykcr+01O03QRuqBfSJk CKQ8zCWLG+5Y2L+/ZLXa7Le/UG2trAbGxDTUfJWUGjohNBewZmIkyf2BCHIxtdXh 0ANiyZFPCCOwowLLBasMsHF8QE2PFo2kMVAU56I/zlJiufJMFrFy6TFIrjofQ7Ut 6RU6mi1hsO08c8503/6rxQumSpu9sifWbOGYmYQkn1ixDCM91gcAXS8PGP13xoNz BqTB4K8OU8Q1vL3G52i84bNpPZ/X7E70A7Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdekleegfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpeffhffvvefukfhfgggtuggjsehttdfstddttddvnecuhfhrohhmpefmihhrhihlucfu hhhuthhsvghmrghuuceokhhirhhilhhlsehshhhuthgvmhhovhdrnhgrmhgvqeenucggtf frrghtthgvrhhnpeegfeehleevvdetffeluefftdffledvgfetheegieevtefgfefhieej heevkeeigeenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepkhhirhhilhhlsehshhhuthgvmhho vhdrnhgrmhgvpdhnsggprhgtphhtthhopedviedpmhhouggvpehsmhhtphhouhhtpdhrtg hpthhtoheprhihrghnrdhrohgsvghrthhssegrrhhmrdgtohhmpdhrtghpthhtoheprghk phhmsehlihhnuhigqdhfohhunhgurghtihhonhdrohhrghdprhgtphhtthhopegurghvih gusehrvgguhhgrthdrtghomhdprhgtphhtthhopehlohhrvghniihordhsthhorghkvghs sehorhgrtghlvgdrtghomhdprhgtphhtthhopehlihgrmhdrhhhofihlvghtthesohhrrg gtlhgvrdgtohhmpdhrtghpthhtohepvhgsrggskhgrsehsuhhsvgdrtgiipdhrtghpthht oheprhhpphhtsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehsuhhrvghnsgesghhooh hglhgvrdgtohhmpdhrtghpthhtohepmhhhohgtkhhosehsuhhsvgdrtghomh X-ME-Proxy: Feedback-ID: ie3994620:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 3 Oct 2025 12:54:05 -0400 (EDT) Date: Fri, 3 Oct 2025 17:54:03 +0100 From: Kiryl Shutsemau To: Ryan Roberts Cc: Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Amir Goldstein , linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v1] fsnotify: Pass correct offset to fsnotify_mmap_perm() Message-ID: References: <20251003155238.2147410-1-ryan.roberts@arm.com> <76cd6212-c85f-4337-99cf-67824c3abee7@arm.com> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <76cd6212-c85f-4337-99cf-67824c3abee7@arm.com> X-DKIM: signer='shutemov.name' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-DKIM: signer='messagingengine.com' status='pass' reason='' X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in sa-trusted.bondedsender.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On Fri, Oct 03, 2025 at 05:36:23PM +0100, Ryan Roberts wrote: > On 03/10/2025 17:00, Kiryl Shutsemau wrote: > > On Fri, Oct 03, 2025 at 04:52:36PM +0100, Ryan Roberts wrote: > >> fsnotify_mmap_perm() requires a byte offset for the file about to be > >> mmap'ed. But it is called from vm_mmap_pgoff(), which has a page offset. > >> Previously the conversion was done incorrectly so let's fix it, being > >> careful not to overflow on 32-bit platforms. > >> > >> Discovered during code review. > > > > Heh. Just submitted fix for the same issue: > > > > https://lore.kernel.org/all/20251003155804.1571242-1-kirill@shutemov.name/T/#u > > > > Ha... great minds... > > I notice that for your version you're just doing "pgoff << PAGE_SHIFT" without > casting pgoff. > > I'm not sure if that is safe? > > pgoff is unsigned long (so 32 bits on 32 bit systems). loff_t is unsigned long > long (so always 64 bits). So is it possible that you shift off the end of 32 > bits and lose those bits without a cast to loff_t first? > > TBH my knowledge of the exact rules is shaky... I think you are right. Missing cast in my patch might be problematic on 32-bit machines. Reviewed-by: Kiryl Shutsemau -- Kiryl Shutsemau / Kirill A. Shutemov From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id 2I1tHZL732jIBiYAYBR5ng (envelope-from ) for ; Fri, 03 Oct 2025 16:36:34 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Fri, 03 Oct 2025 16:36:34 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v4ilm-0000000AVor-1DLh for hi@josie.lol; Fri, 03 Oct 2025 16:36:34 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 7A9EB4ED7B6 for ; Fri, 3 Oct 2025 16:36:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 05E4E2C1583; Fri, 3 Oct 2025 16:36:30 +0000 (UTC) X-Original-To: stable@vger.kernel.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 36B472C1590; Fri, 3 Oct 2025 16:36:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759509389; cv=none; b=Haq5TCqnDG/VrSWaZqk4q3pv7xLA3kw1SlWg4ypCb3Zf3fA4gQH8UzTFSlN9v6g4P8F5tcwHqiK/4RtqofEuXRMfVrvgyqt9Ps3DbtUmGvjJ3zzaycpLAa5z/o669zm1Y8KyJp1KYMJapGBmasq15ee06zH8xQTT6pOCGysbfJU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759509389; c=relaxed/simple; bh=OCfs19P87VGJo08ZZgcfZKtGbh0uMUtCCXPiocshtKY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=dQ17/tqxWhZKVVtLrZlUERCqCHeeizDiDq9pU1evniYqKx0NpBWQCuOwAvdrIJjnkTintD/VktxWCBFLOb67FCe2ED9trlx3d1EefJ+bUtcKnCbOqNU3XiV5H7jQvTvpSCSZU6j/xtSBcNIY51j0FQWoDxCbhOTbn1JrHJ6IBFQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5FC161688; Fri, 3 Oct 2025 09:36:19 -0700 (PDT) Received: from [10.57.81.90] (unknown [10.57.81.90]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 34D673F5A1; Fri, 3 Oct 2025 09:36:25 -0700 (PDT) Message-ID: <76cd6212-c85f-4337-99cf-67824c3abee7@arm.com> Date: Fri, 3 Oct 2025 17:36:23 +0100 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1] fsnotify: Pass correct offset to fsnotify_mmap_perm() Content-Language: en-GB To: Kiryl Shutsemau Cc: Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Amir Goldstein , linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20251003155238.2147410-1-ryan.roberts@arm.com> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 5 On 03/10/2025 17:00, Kiryl Shutsemau wrote: > On Fri, Oct 03, 2025 at 04:52:36PM +0100, Ryan Roberts wrote: >> fsnotify_mmap_perm() requires a byte offset for the file about to be >> mmap'ed. But it is called from vm_mmap_pgoff(), which has a page offset. >> Previously the conversion was done incorrectly so let's fix it, being >> careful not to overflow on 32-bit platforms. >> >> Discovered during code review. > > Heh. Just submitted fix for the same issue: > > https://lore.kernel.org/all/20251003155804.1571242-1-kirill@shutemov.name/T/#u > Ha... great minds... I notice that for your version you're just doing "pgoff << PAGE_SHIFT" without casting pgoff. I'm not sure if that is safe? pgoff is unsigned long (so 32 bits on 32 bit systems). loff_t is unsigned long long (so always 64 bits). So is it possible that you shift off the end of 32 bits and lose those bits without a cast to loff_t first? TBH my knowledge of the exact rules is shaky... From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id oPw6D0Pz32gYeyEAYBR5ng (envelope-from ) for ; Fri, 03 Oct 2025 16:01:07 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Fri, 03 Oct 2025 16:01:07 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v4iDS-00000009DZ7-3RQx for hi@josie.lol; Fri, 03 Oct 2025 16:01:07 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B8EE11888D87 for ; Fri, 3 Oct 2025 16:01:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4BBCE29BDB5; Fri, 3 Oct 2025 16:01:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=shutemov.name header.i=@shutemov.name header.b="Xvdg8Y9w"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="cpZY+MJ/" X-Original-To: stable@vger.kernel.org Received: from fhigh-a3-smtp.messagingengine.com (fhigh-a3-smtp.messagingengine.com [103.168.172.154]) (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 6FFDD292B4B; Fri, 3 Oct 2025 16:01:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.154 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759507262; cv=none; b=bGfVsWY7/WAWLS1Z16a20aM5/GGAiRR+lgIK5tfyPZDuWJbrlA0WoTB33Bg/sIi2yLwR4fS69vVRMH95bkf++TEUJRArPQucJDMJ1I4iKI7Va2irARMJNq92fZyVt4X7GoqQOIzsYxV/JdCxnlOsVJkORp3V7brI3vqu4IW+63k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759507262; c=relaxed/simple; bh=cdlQo7Y0j4hHgbuw4Af+XboBL8Bb06NJHd8C8Lwhbnc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NHU1wL6beOh2oT5fQo121Mv8rD46OEf6SpvNUegK1NyYQuSpWv+7rl8tjWv5WjGpUTF5ceWbCRZZwJQsoc//YqZrXIyNz1TV4tPgM7l6rzYFfXssXNuc2RnbVx231g8HT6Z/9eXidAZ5QtdhoVVsvWuc0q9Gv044Uv0mBpe8uh4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name; spf=pass smtp.mailfrom=shutemov.name; dkim=pass (2048-bit key) header.d=shutemov.name header.i=@shutemov.name header.b=Xvdg8Y9w; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=cpZY+MJ/; arc=none smtp.client-ip=103.168.172.154 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=shutemov.name Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfhigh.phl.internal (Postfix) with ESMTP id 93F7514001D6; Fri, 3 Oct 2025 12:00:59 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Fri, 03 Oct 2025 12:00:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov.name; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm3; t=1759507259; x= 1759593659; bh=nV/TvSgZMitb0mxDDmCIB9D+mWhQJM8naIFJGNjXnfw=; b=X vdg8Y9wrz7KOgx02N4V6QTvP+I88EWKv4coweQ50qVLJ9L+plpwIbw8onRT2eqFC iUGBbOnmRxfEfWibOq8YsFiFMZuXeHIofOGo2V9DAWhjDbEqUOlcyw3sCx4kM2rU lA9PHa5z81ukytEI0Lg1g41W7K/kx8U+7ETKuQX0PJ00eE5fAI6xCMfiddYiGdHk +alcc7UoHhAn9DdJyM3ykEY15qDbY85E437XhTB//W6pypnas2IW4ch7KdYcY/T7 s7BtlQS73sc3AtU3RjlfhBozqVuRvf7tVc4Jg1Wv9zEa4M5+svaqZa5o9Q+k8H2U MOGybciyN/5w+aXmgxl7A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1759507259; x=1759593659; bh=nV/TvSgZMitb0mxDDmCIB9D+mWhQJM8naIF JGNjXnfw=; b=cpZY+MJ/jqAETe+7MKtZonnmhDfkmDbsw8N1aPNW3IMixUGRWfy Hf/N/9csiWZd6qNIok6pl05og0nWNWxoQmjWNMtnrumIfoa9iem/bJjbI/+99JsC JQfOaTXetu0Vsi15UKU0Kc55V5yKClOdLn5sWo8yHUtSmEvIUpmaQRCtYNm2V8ri 9HudK9zrk8LBf3/tLlK93FOcb3T5VUBFOztnxUvW3q/+HINjkThrsSWpBid83N1r za7Fin4+xlvZb2ZURQAfMu8xmlcuV1pPIQwTrkjZ8vJMvaaOXEfV1QemOwuCgbCx nXobwVcDhZ5RMla2foxPKodK15JBbRHOCIQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdekleefvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpeffhffvvefukfhfgggtuggjsehttdfstddttddvnecuhfhrohhmpefmihhrhihlucfu hhhuthhsvghmrghuuceokhhirhhilhhlsehshhhuthgvmhhovhdrnhgrmhgvqeenucggtf frrghtthgvrhhnpeegfeehleevvdetffeluefftdffledvgfetheegieevtefgfefhieej heevkeeigeenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepkhhirhhilhhlsehshhhuthgvmhho vhdrnhgrmhgvpdhnsggprhgtphhtthhopedviedpmhhouggvpehsmhhtphhouhhtpdhrtg hpthhtoheprhihrghnrdhrohgsvghrthhssegrrhhmrdgtohhmpdhrtghpthhtoheprghk phhmsehlihhnuhigqdhfohhunhgurghtihhonhdrohhrghdprhgtphhtthhopegurghvih gusehrvgguhhgrthdrtghomhdprhgtphhtthhopehlohhrvghniihordhsthhorghkvghs sehorhgrtghlvgdrtghomhdprhgtphhtthhopehlihgrmhdrhhhofihlvghtthesohhrrg gtlhgvrdgtohhmpdhrtghpthhtohepvhgsrggskhgrsehsuhhsvgdrtgiipdhrtghpthht oheprhhpphhtsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehsuhhrvghnsgesghhooh hglhgvrdgtohhmpdhrtghpthhtohepmhhhohgtkhhosehsuhhsvgdrtghomh X-ME-Proxy: Feedback-ID: ie3994620:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 3 Oct 2025 12:00:58 -0400 (EDT) Date: Fri, 3 Oct 2025 17:00:56 +0100 From: Kiryl Shutsemau To: Ryan Roberts Cc: Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Amir Goldstein , linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v1] fsnotify: Pass correct offset to fsnotify_mmap_perm() Message-ID: References: <20251003155238.2147410-1-ryan.roberts@arm.com> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251003155238.2147410-1-ryan.roberts@arm.com> X-DKIM: signer='shutemov.name' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-DKIM: signer='messagingengine.com' status='pass' reason='' X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: shutemov.name] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [147.75.80.249 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.80.249 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [147.75.80.249 listed in sa-accredit.habeas.com] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 On Fri, Oct 03, 2025 at 04:52:36PM +0100, Ryan Roberts wrote: > fsnotify_mmap_perm() requires a byte offset for the file about to be > mmap'ed. But it is called from vm_mmap_pgoff(), which has a page offset. > Previously the conversion was done incorrectly so let's fix it, being > careful not to overflow on 32-bit platforms. > > Discovered during code review. Heh. Just submitted fix for the same issue: https://lore.kernel.org/all/20251003155804.1571242-1-kirill@shutemov.name/T/#u -- Kiryl Shutsemau / Kirill A. Shutemov From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id qAzlM13x32jwlh4AYBR5ng (envelope-from ) for ; Fri, 03 Oct 2025 15:53:01 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Fri, 03 Oct 2025 15:53:01 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v4i5d-00000008rN0-0yhs for hi@josie.lol; Fri, 03 Oct 2025 15:53:01 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 66B614EBDD5 for ; Fri, 3 Oct 2025 15:53:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5D06F28725F; Fri, 3 Oct 2025 15:52:57 +0000 (UTC) X-Original-To: stable@vger.kernel.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E646713AD05; Fri, 3 Oct 2025 15:52:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759506777; cv=none; b=ScbGdZN2eERfBRAT1eYme7TcM/7/fs+wkjtbxERqDYyGo1SfAK0FMT7psLf9Ij3T9MY+XZbypnQlpl4adzNl/M0DKHsH5CKnf6tPzkbHjNG5wQ8+dN+p8YmjZCW3qXB92AXXrCAXm3DvJsHIBZeXahzI/fXQvmaqbS4g2zT3+uo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759506777; c=relaxed/simple; bh=asfviRWMj20n09VoR3dloG3HCRbrpqH0UwLvom6TA+c=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=nsLcxSGmDiQz4dxZPt6/kgwl39fTgSt+4z7xP2I0AjtLews24r17NgHXR6THORwNYY+KBAkJyE4EX4fMcaLJ+YOq4gYdhpkfPdmQeTMQra1uJlzgLfP6erA2vnJG9JigjV7ayVkHi7qYd6FYyG4arENR99di87nX58hJVTWtnrE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8872F1655; Fri, 3 Oct 2025 08:52:40 -0700 (PDT) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.27]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8D5BC3F5A1; Fri, 3 Oct 2025 08:52:46 -0700 (PDT) From: Ryan Roberts To: Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Amir Goldstein Cc: Ryan Roberts , linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v1] fsnotify: Pass correct offset to fsnotify_mmap_perm() Date: Fri, 3 Oct 2025 16:52:36 +0100 Message-ID: <20251003155238.2147410-1-ryan.roberts@arm.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.5 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [142.0.200.124 listed in sa-trusted.bondedsender.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 5 fsnotify_mmap_perm() requires a byte offset for the file about to be mmap'ed. But it is called from vm_mmap_pgoff(), which has a page offset. Previously the conversion was done incorrectly so let's fix it, being careful not to overflow on 32-bit platforms. Discovered during code review. Cc: Fixes: 066e053fe208 ("fsnotify: add pre-content hooks on mmap()") Signed-off-by: Ryan Roberts --- Applies against today's mm-unstable (aa05a436eca8). Thanks, Ryan mm/util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/util.c b/mm/util.c index 6c1d64ed0221..8989d5767528 100644 --- a/mm/util.c +++ b/mm/util.c @@ -566,6 +566,7 @@ unsigned long vm_mmap_pgoff(struct file *file, unsigned long addr, unsigned long len, unsigned long prot, unsigned long flag, unsigned long pgoff) { + loff_t off = (loff_t)pgoff << PAGE_SHIFT; unsigned long ret; struct mm_struct *mm = current->mm; unsigned long populate; @@ -573,7 +574,7 @@ unsigned long vm_mmap_pgoff(struct file *file, unsigned long addr, ret = security_mmap_file(file, prot, flag); if (!ret) - ret = fsnotify_mmap_perm(file, prot, pgoff >> PAGE_SHIFT, len); + ret = fsnotify_mmap_perm(file, prot, off, len); if (!ret) { if (mmap_write_lock_killable(mm)) return -EINTR; -- 2.43.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id MI19KcRX7mjHAR0AYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 14:01:40 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 14:01:40 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8fau-00000008ss4-0UDw for hi@josie.lol; Tue, 14 Oct 2025 14:01:40 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 344413B9C18 for ; Tue, 14 Oct 2025 14:01:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CFC0126E701; Tue, 14 Oct 2025 14:01:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oYaAfVO0" X-Original-To: stable@vger.kernel.org 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 ABD4F262A6 for ; Tue, 14 Oct 2025 14:01:35 +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=1760450495; cv=none; b=f/JGH5UweC+z37Uvqb57keQbUzVH7Hc1OHdr3pduiFdN0zAyEk9eezOQ4cr56EpleqV6q9KEV92ZK6YqRBC4lRgZX5Km5NsETUmINBZSqnSYZw9BoicAoXhok/0z3JoGZUMPPEpy7FSRvJFF7ricYKF8xrL42ChmACRin31xmpE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760450495; c=relaxed/simple; bh=GS4WjnV89P/OiUmoRaXlo4cH2G9aMOil736KWbFkppo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gjZ5PzhQmiJG6fTksVBuhATnory9U7wvlMHoyfHCrv4k27smcrWjR7NQMyj7xReVOL1gsZ+PsTtX53FX4qCpzBTOG33yjgF9pWQL+m1wjZOcfXOhbVnmVCCkwe5nkNmoniR29SiI3l916OHOHsftRB93q309CgNZAe5CHdD3n/k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oYaAfVO0; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08F4BC4CEE7; Tue, 14 Oct 2025 14:01:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760450495; bh=GS4WjnV89P/OiUmoRaXlo4cH2G9aMOil736KWbFkppo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oYaAfVO0VuCVIo9jiegk4MVF94oHgpnxgqxX+vqJ+0DtrcVa4zquJ2rW97xnMeFVg qDKJeWl/EuRODQBqfYRhOOCfA6gLVl2DRcxJj2sVoBgwYDIq4vQlhqq2qaVYeHFwqH 5ZbAtJwbqWvuVP+kZZnID7d5hq/vF2L9voD4lRd/gdN8Za2kpO+gO7th5d6LxBdBCO NERMkAPCB5KnryKu9hqD/qPurxY7Ti5bh7/HlZVtxGfw1peO6EaN0a3s8MB34kzeOG pbQ3Y9QVoiyAavMb0XoaFoklVREh43GZDh5P4vJiMsGe6N6gwAdfkw22GG4lgT05No ldidTCxrwntRg== From: Sasha Levin To: stable@vger.kernel.org Cc: Donet Tom , Chengming Zhou , David Hildenbrand , Aboorva Devarajan , "Ritesh Harjani (IBM)" , Wei Yang , xu xin , Andrew Morton , Sasha Levin Subject: [PATCH 6.6.y] mm/ksm: fix incorrect KSM counter handling in mm_struct during fork Date: Tue, 14 Oct 2025 10:01:32 -0400 Message-ID: <20251014140132.49794-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2025101300-backspace-pulmonary-5620@gregkh> References: <2025101300-backspace-pulmonary-5620@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -3.5 (---) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-3.5 points) --- pts rule name description ---- ---------------------- ----------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [139.178.88.99 listed in list.dnswl.org] -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -34 From: Donet Tom [ Upstream commit 4d6fc29f36341d7795db1d1819b4c15fe9be7b23 ] Patch series "mm/ksm: Fix incorrect accounting of KSM counters during fork", v3. The first patch in this series fixes the incorrect accounting of KSM counters such as ksm_merging_pages, ksm_rmap_items, and the global ksm_zero_pages during fork. The following patch add a selftest to verify the ksm_merging_pages counter was updated correctly during fork. Test Results ============ Without the first patch ----------------------- # [RUN] test_fork_ksm_merging_page_count not ok 10 ksm_merging_page in child: 32 With the first patch -------------------- # [RUN] test_fork_ksm_merging_page_count ok 10 ksm_merging_pages is not inherited after fork This patch (of 2): Currently, the KSM-related counters in `mm_struct`, such as `ksm_merging_pages`, `ksm_rmap_items`, and `ksm_zero_pages`, are inherited by the child process during fork. This results in inconsistent accounting. When a process uses KSM, identical pages are merged and an rmap item is created for each merged page. The `ksm_merging_pages` and `ksm_rmap_items` counters are updated accordingly. However, after a fork, these counters are copied to the child while the corresponding rmap items are not. As a result, when the child later triggers an unmerge, there are no rmap items present in the child, so the counters remain stale, leading to incorrect accounting. A similar issue exists with `ksm_zero_pages`, which maintains both a global counter and a per-process counter. During fork, the per-process counter is inherited by the child, but the global counter is not incremented. Since the child also references zero pages, the global counter should be updated as well. Otherwise, during zero-page unmerge, both the global and per-process counters are decremented, causing the global counter to become inconsistent. To fix this, ksm_merging_pages and ksm_rmap_items are reset to 0 during fork, and the global ksm_zero_pages counter is updated with the per-process ksm_zero_pages value inherited by the child. This ensures that KSM statistics remain accurate and reflect the activity of each process correctly. Link: https://lkml.kernel.org/r/cover.1758648700.git.donettom@linux.ibm.com Link: https://lkml.kernel.org/r/7b9870eb67ccc0d79593940d9dbd4a0b39b5d396.1758648700.git.donettom@linux.ibm.com Fixes: 7609385337a4 ("ksm: count ksm merging pages for each process") Fixes: cb4df4cae4f2 ("ksm: count allocated ksm rmap_items for each process") Fixes: e2942062e01d ("ksm: count all zero pages placed by KSM") Signed-off-by: Donet Tom Reviewed-by: Chengming Zhou Acked-by: David Hildenbrand Cc: Aboorva Devarajan Cc: David Hildenbrand Cc: Donet Tom Cc: "Ritesh Harjani (IBM)" Cc: Wei Yang Cc: xu xin Cc: [6.6+] Signed-off-by: Andrew Morton [ changed mm_flags_test() to test_bit() ] Signed-off-by: Sasha Levin --- include/linux/ksm.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/ksm.h b/include/linux/ksm.h index b9cdeba03668a..f74c522248401 100644 --- a/include/linux/ksm.h +++ b/include/linux/ksm.h @@ -59,6 +59,12 @@ static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm) int ret; if (test_bit(MMF_VM_MERGEABLE, &oldmm->flags)) { + long nr_ksm_zero_pages = atomic_long_read(&mm->ksm_zero_pages); + + mm->ksm_merging_pages = 0; + mm->ksm_rmap_items = 0; + atomic_long_add(nr_ksm_zero_pages, &ksm_zero_pages); + ret = __ksm_enter(mm); if (ret) return ret; -- 2.51.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id QEKLFR/D7GgEiwsAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 09:15:11 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 09:15:11 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8Ee6-00000003hua-3rQK for hi@josie.lol; Mon, 13 Oct 2025 09:15:11 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 38C573C0E3A for ; Mon, 13 Oct 2025 09:15:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D59DF2FC036; Mon, 13 Oct 2025 09:15:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="pnbEhIDC" X-Original-To: stable@vger.kernel.org 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 AE1C42FC860 for ; Mon, 13 Oct 2025 09:15:07 +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=1760346909; cv=none; b=a6Og4kul4ML47OXhdeCa+kLgJAjVHrPCai5ctY0s2F4vB1ZbBnhP1kffPTDocXfzJsEzqgVQTUYItR0LBt+Go+47A8Y5ySk97g3hGLuAHK5g3m3M0MnEj1Cl1fg8JmqXKSkh+4qqHdcsCJs4dpmONhDvjnzpzuCnqeECiMthWpk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760346909; c=relaxed/simple; bh=xtqkCmLBDY5yt6ZucenIBYbtaR8+cjg81Mrsujkykk8=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=nNeoEuBXWhVqc02G4Gfmtpo9g19h5FHvGbOk0xOLfUuxUQajl0mtngb6fLGcq+GY3I3EwJgd//irAphp0Rw3qQyzKzN2/oEeTuILI/KJxvnLBXkZOSRCiTSbBGUCZz+vsOw7aVQTvY2ge3rs12rNx1YYvyUoqztekDW8DmcPa5I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=pnbEhIDC; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9C13C4CEE7; Mon, 13 Oct 2025 09:15:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760346907; bh=xtqkCmLBDY5yt6ZucenIBYbtaR8+cjg81Mrsujkykk8=; h=Subject:To:Cc:From:Date:From; b=pnbEhIDC0/bv7HrrnzZLz8Di1cHYcHx2Uhgp6xAhK+XwNEszQQM436T4D2YNdJZwU BCc7GL3LPjLv6/EaRaN1NQMhstocU8aLGibGDcv9E8OMqNYqdwyClUzRBVEdbNbrWo uz93N8IPWcKBp6R/nZuH3oLz6ucxocNHZ5bUj4rQ= Subject: FAILED: patch "[PATCH] mm/ksm: fix incorrect KSM counter handling in mm_struct" failed to apply to 6.6-stable tree To: donettom@linux.ibm.com,aboorvad@linux.ibm.com,akpm@linux-foundation.org,chengming.zhou@linux.dev,david@redhat.com,richard.weiyang@gmail.com,ritesh.list@gmail.com,stable@vger.kernel.org,xu.xin16@zte.com.cn Cc: From: Date: Mon, 13 Oct 2025 11:15:00 +0200 Message-ID: <2025101300-backspace-pulmonary-5620@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit X-DKIM: signer='linuxfoundation.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: 4 The patch below does not apply to the 6.6-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y git checkout FETCH_HEAD git cherry-pick -x 4d6fc29f36341d7795db1d1819b4c15fe9be7b23 # git commit -s git send-email --to '' --in-reply-to '2025101300-backspace-pulmonary-5620@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 4d6fc29f36341d7795db1d1819b4c15fe9be7b23 Mon Sep 17 00:00:00 2001 From: Donet Tom Date: Wed, 24 Sep 2025 00:16:59 +0530 Subject: [PATCH] mm/ksm: fix incorrect KSM counter handling in mm_struct during fork Patch series "mm/ksm: Fix incorrect accounting of KSM counters during fork", v3. The first patch in this series fixes the incorrect accounting of KSM counters such as ksm_merging_pages, ksm_rmap_items, and the global ksm_zero_pages during fork. The following patch add a selftest to verify the ksm_merging_pages counter was updated correctly during fork. Test Results ============ Without the first patch ----------------------- # [RUN] test_fork_ksm_merging_page_count not ok 10 ksm_merging_page in child: 32 With the first patch -------------------- # [RUN] test_fork_ksm_merging_page_count ok 10 ksm_merging_pages is not inherited after fork This patch (of 2): Currently, the KSM-related counters in `mm_struct`, such as `ksm_merging_pages`, `ksm_rmap_items`, and `ksm_zero_pages`, are inherited by the child process during fork. This results in inconsistent accounting. When a process uses KSM, identical pages are merged and an rmap item is created for each merged page. The `ksm_merging_pages` and `ksm_rmap_items` counters are updated accordingly. However, after a fork, these counters are copied to the child while the corresponding rmap items are not. As a result, when the child later triggers an unmerge, there are no rmap items present in the child, so the counters remain stale, leading to incorrect accounting. A similar issue exists with `ksm_zero_pages`, which maintains both a global counter and a per-process counter. During fork, the per-process counter is inherited by the child, but the global counter is not incremented. Since the child also references zero pages, the global counter should be updated as well. Otherwise, during zero-page unmerge, both the global and per-process counters are decremented, causing the global counter to become inconsistent. To fix this, ksm_merging_pages and ksm_rmap_items are reset to 0 during fork, and the global ksm_zero_pages counter is updated with the per-process ksm_zero_pages value inherited by the child. This ensures that KSM statistics remain accurate and reflect the activity of each process correctly. Link: https://lkml.kernel.org/r/cover.1758648700.git.donettom@linux.ibm.com Link: https://lkml.kernel.org/r/7b9870eb67ccc0d79593940d9dbd4a0b39b5d396.1758648700.git.donettom@linux.ibm.com Fixes: 7609385337a4 ("ksm: count ksm merging pages for each process") Fixes: cb4df4cae4f2 ("ksm: count allocated ksm rmap_items for each process") Fixes: e2942062e01d ("ksm: count all zero pages placed by KSM") Signed-off-by: Donet Tom Reviewed-by: Chengming Zhou Acked-by: David Hildenbrand Cc: Aboorva Devarajan Cc: David Hildenbrand Cc: Donet Tom Cc: "Ritesh Harjani (IBM)" Cc: Wei Yang Cc: xu xin Cc: [6.6+] Signed-off-by: Andrew Morton diff --git a/include/linux/ksm.h b/include/linux/ksm.h index 22e67ca7cba3..067538fc4d58 100644 --- a/include/linux/ksm.h +++ b/include/linux/ksm.h @@ -56,8 +56,14 @@ static inline long mm_ksm_zero_pages(struct mm_struct *mm) static inline void ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm) { /* Adding mm to ksm is best effort on fork. */ - if (mm_flags_test(MMF_VM_MERGEABLE, oldmm)) + if (mm_flags_test(MMF_VM_MERGEABLE, oldmm)) { + long nr_ksm_zero_pages = atomic_long_read(&mm->ksm_zero_pages); + + mm->ksm_merging_pages = 0; + mm->ksm_rmap_items = 0; + atomic_long_add(nr_ksm_zero_pages, &ksm_zero_pages); __ksm_enter(mm); + } } static inline int ksm_execve(struct mm_struct *mm) From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id wOi7GFxj7mhzUiYAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 14:51:08 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 14:51:08 +0000 Received: from sv.mirrors.kernel.org ([139.178.88.99]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8gMm-0000000AiF9-01zR for hi@josie.lol; Tue, 14 Oct 2025 14:51:08 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A8847580433 for ; Tue, 14 Oct 2025 14:47:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9D5D42FFDCC; Tue, 14 Oct 2025 14:46:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="V2IY7gce" X-Original-To: stable@vger.kernel.org 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 780892FCC04 for ; Tue, 14 Oct 2025 14:46:51 +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=1760453211; cv=none; b=Fd9B18r1XhWjxECOQzjccZXroXIjSeuH08vdzqVvf4GdpTDDz1UCoJzvwUdz5E/4Xlprs8JeOe1ARDtz+n++79DTiYZ2R/CrhCR1iugVGyUoELPUE4fRRe332wPvZgOAgblLTiaYdvIXmmQYcg9qXN8BHklGoXS8cbeUEKhs6Ig= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760453211; c=relaxed/simple; bh=akDqgra0hrPzVfHQ6gGZXcua7Q5snQ6ZwH8C2E+NzfM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EbZHbaSPmY7rBEofc3/rNjNvPPVdttAo13TCZPD707DwVwibKOXa7UdoGonBDuk+8vpalOWpvND92Evo5Ea4LfR510GEBzBjrkcAK0n5fv4Stz/UcOJeablPn51djFbmAOvqC/UjU3/5pQbvKxDf7eyLCU+67qAFrZFVMVggmcQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=V2IY7gce; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B080C4CEE7; Tue, 14 Oct 2025 14:46:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760453209; bh=akDqgra0hrPzVfHQ6gGZXcua7Q5snQ6ZwH8C2E+NzfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V2IY7gcev9n/mocutfXxUcEuh+iNShtxaXALgruVT3FClt9dBB2xc9oE9zBWiCyiy hkLzjfgEza6OtOblHK4Q+8dUdrjCa5plvZXeT5H3Z2+w1Hnz1580J/AimYV9qMblC4 VkhHiw35gTx7h6Y7aQ3DkSR68TFJ8TYLtiPJdDE4IvNzy5JKTFgMueEO/FJ/0YlTft cCEIvkiqZbsSoAgNK6JKo36k24IG1XebFpwaznAKi7ky67vQ9X7638ZE+CsRW5XxKp eLHjG2KYY0jHeIZCdCQqTjLilxbYWoe5QFN5bXYLw8+/vs+JSVmJ/RoWMQujhgr5kq hM8fmCHzfj/2Q== From: Sasha Levin To: stable@vger.kernel.org Cc: Namjae Jeon , Steve French , Sasha Levin Subject: [PATCH 6.6.y] ksmbd: add max ip connections parameter Date: Tue, 14 Oct 2025 10:46:46 -0400 Message-ID: <20251014144646.91722-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2025101339-refocus-negotiate-7718@gregkh> References: <2025101339-refocus-negotiate-7718@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='kernel.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.2 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.2 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [139.178.88.99 listed in list.dnswl.org] -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: -11 From: Namjae Jeon [ Upstream commit d8b6dc9256762293048bf122fc11c4e612d0ef5d ] This parameter set the maximum number of connections per ip address. The default is 8. Cc: stable@vger.kernel.org Fixes: c0d41112f1a5 ("ksmbd: extend the connection limiting mechanism to support IPv6") Signed-off-by: Namjae Jeon Signed-off-by: Steve French [ Adjust reserved room ] Signed-off-by: Sasha Levin --- fs/smb/server/ksmbd_netlink.h | 5 +++-- fs/smb/server/server.h | 1 + fs/smb/server/transport_ipc.c | 3 +++ fs/smb/server/transport_tcp.c | 28 +++++++++++++++++----------- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/fs/smb/server/ksmbd_netlink.h b/fs/smb/server/ksmbd_netlink.h index f4e55199938d5..c6c1844d44482 100644 --- a/fs/smb/server/ksmbd_netlink.h +++ b/fs/smb/server/ksmbd_netlink.h @@ -108,10 +108,11 @@ struct ksmbd_startup_request { __u32 smb2_max_credits; /* MAX credits */ __u32 smbd_max_io_size; /* smbd read write size */ __u32 max_connections; /* Number of maximum simultaneous connections */ - __u32 reserved[126]; /* Reserved room */ + __u32 max_ip_connections; /* Number of maximum connection per ip address */ + __u32 reserved[125]; /* Reserved room */ __u32 ifc_list_sz; /* interfaces list size */ __s8 ____payload[]; -}; +} __packed; #define KSMBD_STARTUP_CONFIG_INTERFACES(s) ((s)->____payload) diff --git a/fs/smb/server/server.h b/fs/smb/server/server.h index 4d06f2eb0d6ad..d0744498ceed6 100644 --- a/fs/smb/server/server.h +++ b/fs/smb/server/server.h @@ -43,6 +43,7 @@ struct ksmbd_server_config { unsigned int auth_mechs; unsigned int max_connections; unsigned int max_inflight_req; + unsigned int max_ip_connections; char *conf[SERVER_CONF_WORK_GROUP + 1]; }; diff --git a/fs/smb/server/transport_ipc.c b/fs/smb/server/transport_ipc.c index 281101fd1f76f..80581a7bc1bcc 100644 --- a/fs/smb/server/transport_ipc.c +++ b/fs/smb/server/transport_ipc.c @@ -321,6 +321,9 @@ static int ipc_server_config_on_startup(struct ksmbd_startup_request *req) if (req->max_connections) server_conf.max_connections = req->max_connections; + if (req->max_ip_connections) + server_conf.max_ip_connections = req->max_ip_connections; + ret = ksmbd_set_netbios_name(req->netbios_name); ret |= ksmbd_set_server_string(req->server_string); ret |= ksmbd_set_work_group(req->work_group); diff --git a/fs/smb/server/transport_tcp.c b/fs/smb/server/transport_tcp.c index 53c536f2ce9f9..c43a465114289 100644 --- a/fs/smb/server/transport_tcp.c +++ b/fs/smb/server/transport_tcp.c @@ -240,6 +240,7 @@ static int ksmbd_kthread_fn(void *p) struct interface *iface = (struct interface *)p; struct ksmbd_conn *conn; int ret; + unsigned int max_ip_conns; while (!kthread_should_stop()) { mutex_lock(&iface->sock_release_lock); @@ -257,34 +258,39 @@ static int ksmbd_kthread_fn(void *p) continue; } + if (!server_conf.max_ip_connections) + goto skip_max_ip_conns_limit; + /* * Limits repeated connections from clients with the same IP. */ + max_ip_conns = 0; down_read(&conn_list_lock); - list_for_each_entry(conn, &conn_list, conns_list) + list_for_each_entry(conn, &conn_list, conns_list) { #if IS_ENABLED(CONFIG_IPV6) if (client_sk->sk->sk_family == AF_INET6) { if (memcmp(&client_sk->sk->sk_v6_daddr, - &conn->inet6_addr, 16) == 0) { - ret = -EAGAIN; - break; - } + &conn->inet6_addr, 16) == 0) + max_ip_conns++; } else if (inet_sk(client_sk->sk)->inet_daddr == - conn->inet_addr) { - ret = -EAGAIN; - break; - } + conn->inet_addr) + max_ip_conns++; #else if (inet_sk(client_sk->sk)->inet_daddr == - conn->inet_addr) { + conn->inet_addr) + max_ip_conns++; +#endif + if (server_conf.max_ip_connections <= max_ip_conns) { ret = -EAGAIN; break; } -#endif + } up_read(&conn_list_lock); if (ret == -EAGAIN) continue; +skip_max_ip_conns_limit: + if (server_conf.max_connections && atomic_inc_return(&active_num_conn) >= server_conf.max_connections) { pr_info_ratelimited("Limit the maximum number of connections(%u)\n", -- 2.51.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id ANgVNUPD7GjDPQwAYBR5ng (envelope-from ) for ; Mon, 13 Oct 2025 09:15:47 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Mon, 13 Oct 2025 09:15:47 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8Eeg-00000003ixR-14Pg for hi@josie.lol; Mon, 13 Oct 2025 09:15:46 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 4A9EC4E8229 for ; Mon, 13 Oct 2025 09:15:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 989052FC01D; Mon, 13 Oct 2025 09:15:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ulDQrkz8" X-Original-To: stable@vger.kernel.org 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 726B62FC015 for ; Mon, 13 Oct 2025 09:15:42 +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=1760346942; cv=none; b=PpolKGpmqAwQEcCySa1FR8DYGsliZDDPNgzHXbqfrpWMDO8cevcpRFYj1n+dMv1M2IHV1IwlNyAejUGBuaVcJfrNfiZAeo1vvRAYYpB8m9VNKdOdl7avhXS4GAvmXdcI3rIeAwoG85y6Ez7n42+RTY5CkOnLAqjdq0nR05M9Qhk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760346942; c=relaxed/simple; bh=zIeEC+1Tw1pk3aP2ZrRopmIdxptYi++jYTaavesrbBQ=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=mzEVa97BqB0LrxGJDGXVjHUAHVZ56SmYYSqXvG+wxymnxTikC7ijAkuMJyiVu5S98r/G6OAnwkHBLRoXn/8xXuVgmzjllflrA4aMGmlPYOmkWQwDQlnkBbsTk8ybtO3ndUghfQ2NbJeV85ma2LcKhWvMjPcua9Xe/zBiAJNgYTA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ulDQrkz8; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E99CC4CEE7; Mon, 13 Oct 2025 09:15:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760346941; bh=zIeEC+1Tw1pk3aP2ZrRopmIdxptYi++jYTaavesrbBQ=; h=Subject:To:Cc:From:Date:From; b=ulDQrkz8HxzoTS/dg9gpCdkxFGY+RnUhRKrPjBwsya8k1ArV1HiBwuxKF2YnKhYKz XXcjKwG216bRDHQ4UcLjfU+Eoo2bhKM8uH2YCWC+XBS9v+P0+MnT7fJCsuvBw3ArDs ZlYEalPD8KzWuaK0o9qyOoTPbJvk1yef5dpxJxys= Subject: FAILED: patch "[PATCH] ksmbd: add max ip connections parameter" failed to apply to 6.6-stable tree To: linkinjeon@kernel.org,stfrench@microsoft.com Cc: From: Date: Mon, 13 Oct 2025 11:15:39 +0200 Message-ID: <2025101339-refocus-negotiate-7718@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit X-DKIM: signer='linuxfoundation.org' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linuxfoundation.org] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender SpamTally: Final spam score: 4 The patch below does not apply to the 6.6-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y git checkout FETCH_HEAD git cherry-pick -x d8b6dc9256762293048bf122fc11c4e612d0ef5d # git commit -s git send-email --to '' --in-reply-to '2025101339-refocus-negotiate-7718@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From d8b6dc9256762293048bf122fc11c4e612d0ef5d Mon Sep 17 00:00:00 2001 From: Namjae Jeon Date: Wed, 1 Oct 2025 09:25:35 +0900 Subject: [PATCH] ksmbd: add max ip connections parameter This parameter set the maximum number of connections per ip address. The default is 8. Cc: stable@vger.kernel.org Fixes: c0d41112f1a5 ("ksmbd: extend the connection limiting mechanism to support IPv6") Signed-off-by: Namjae Jeon Signed-off-by: Steve French diff --git a/fs/smb/server/ksmbd_netlink.h b/fs/smb/server/ksmbd_netlink.h index 3f07a612c05b..8ccd57fd904b 100644 --- a/fs/smb/server/ksmbd_netlink.h +++ b/fs/smb/server/ksmbd_netlink.h @@ -112,10 +112,11 @@ struct ksmbd_startup_request { __u32 smbd_max_io_size; /* smbd read write size */ __u32 max_connections; /* Number of maximum simultaneous connections */ __s8 bind_interfaces_only; - __s8 reserved[503]; /* Reserved room */ + __u32 max_ip_connections; /* Number of maximum connection per ip address */ + __s8 reserved[499]; /* Reserved room */ __u32 ifc_list_sz; /* interfaces list size */ __s8 ____payload[]; -}; +} __packed; #define KSMBD_STARTUP_CONFIG_INTERFACES(s) ((s)->____payload) diff --git a/fs/smb/server/server.h b/fs/smb/server/server.h index 995555febe7d..b8a7317be86b 100644 --- a/fs/smb/server/server.h +++ b/fs/smb/server/server.h @@ -43,6 +43,7 @@ struct ksmbd_server_config { unsigned int auth_mechs; unsigned int max_connections; unsigned int max_inflight_req; + unsigned int max_ip_connections; char *conf[SERVER_CONF_WORK_GROUP + 1]; struct task_struct *dh_task; diff --git a/fs/smb/server/transport_ipc.c b/fs/smb/server/transport_ipc.c index 2a3e2b0ce557..2aa1b29bea08 100644 --- a/fs/smb/server/transport_ipc.c +++ b/fs/smb/server/transport_ipc.c @@ -335,6 +335,9 @@ static int ipc_server_config_on_startup(struct ksmbd_startup_request *req) if (req->max_connections) server_conf.max_connections = req->max_connections; + if (req->max_ip_connections) + server_conf.max_ip_connections = req->max_ip_connections; + ret = ksmbd_set_netbios_name(req->netbios_name); ret |= ksmbd_set_server_string(req->server_string); ret |= ksmbd_set_work_group(req->work_group); diff --git a/fs/smb/server/transport_tcp.c b/fs/smb/server/transport_tcp.c index 7440a2fd1126..e9ecb43db9d9 100644 --- a/fs/smb/server/transport_tcp.c +++ b/fs/smb/server/transport_tcp.c @@ -225,6 +225,7 @@ static int ksmbd_kthread_fn(void *p) struct interface *iface = (struct interface *)p; struct ksmbd_conn *conn; int ret; + unsigned int max_ip_conns; while (!kthread_should_stop()) { mutex_lock(&iface->sock_release_lock); @@ -242,34 +243,38 @@ static int ksmbd_kthread_fn(void *p) continue; } + if (!server_conf.max_ip_connections) + goto skip_max_ip_conns_limit; + /* * Limits repeated connections from clients with the same IP. */ + max_ip_conns = 0; down_read(&conn_list_lock); - list_for_each_entry(conn, &conn_list, conns_list) + list_for_each_entry(conn, &conn_list, conns_list) { #if IS_ENABLED(CONFIG_IPV6) if (client_sk->sk->sk_family == AF_INET6) { if (memcmp(&client_sk->sk->sk_v6_daddr, - &conn->inet6_addr, 16) == 0) { - ret = -EAGAIN; - break; - } + &conn->inet6_addr, 16) == 0) + max_ip_conns++; } else if (inet_sk(client_sk->sk)->inet_daddr == - conn->inet_addr) { - ret = -EAGAIN; - break; - } + conn->inet_addr) + max_ip_conns++; #else if (inet_sk(client_sk->sk)->inet_daddr == - conn->inet_addr) { + conn->inet_addr) + max_ip_conns++; +#endif + if (server_conf.max_ip_connections <= max_ip_conns) { ret = -EAGAIN; break; } -#endif + } up_read(&conn_list_lock); if (ret == -EAGAIN) continue; +skip_max_ip_conns_limit: if (server_conf.max_connections && atomic_inc_return(&active_num_conn) >= server_conf.max_connections) { pr_info_ratelimited("Limit the maximum number of connections(%u)\n", From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id QAmqBydm7mi8CiMAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 15:03:03 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 15:03:03 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8gYI-0000000B8TQ-3Ja4 for hi@josie.lol; Tue, 14 Oct 2025 15:03:03 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B86D018978A5 for ; Tue, 14 Oct 2025 15:03:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 15FCA2FFDD4; Tue, 14 Oct 2025 15:01:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HDr4RLYn" X-Original-To: io-uring@vger.kernel.org Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 49586278772 for ; Tue, 14 Oct 2025 15:01:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760454111; cv=none; b=jGcp/WT3HrpT1fDz+UWvetLtuR2JmWTfq6U9V38B4v/r57pSgX9Zg5y2wuCEw3gNBA3hvcdMVEwHgXMjm5xk+eCxavyyHgViXjOdZFX3QSaLa1mI98oMOZFvSUfIq/MZhtTPiHIq4SfuNRw7aMbl8TK/skfu9PybESWVhdZMG0w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760454111; c=relaxed/simple; bh=8CBKQ+xkCR4hzJpn9s7KY4kzeYFCVYt0xrgXy9KSJBs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UQb9k1A2bzTiZsfIiq+14wADiSyKyyiJ+yi2sCb1Ogrffn+4neCE9AVlxzjBxCGkUbh9Lu+4GLpQkJLcSv25IgA33KK6X8KMZKvIhWkdy4pIGvgKRCSI1FAexkIN8tB9SQX69kDL9YjIhRyKhwbqRIzqHgeD83wu5ImMlV5ZZyA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HDr4RLYn; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-46e3a50bc0fso40949625e9.3 for ; Tue, 14 Oct 2025 08:01:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760454107; x=1761058907; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SrYu44JadHRt7GuwzjcxjZ0wn2Xq6CWmDu0PRz9ln7A=; b=HDr4RLYnR07xujJ8fATRP1iYJvQJ9Ni6pYXvsufAnSUVyRooxbhcoRCheY8KFBWzCR fnHT1B4LNLeMQ2RteY7Pob0sVQh0Ff1vyRGrqS0H/U/j5MO+taaeLCvDZJtsq0FxlX8c 4ZkW+uWS06hmt49Kegn1JHTuw1vdhklCNgGit6kCrp18nxf0C71+Rjd5Ei4T29NT9Ydi TfmB7v+QCOit5OunPh79jGyYzgDZlUTbkApWpNiXiYXDWpfGfzQkdGq8KyWATr5XQgNB ixgshF/oxVlaYi6CZ4Rx9aP+MoUNfnxwLGDMsWX3REkRmqpES4MUrUDsIlUCjVGPMa1i JWuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760454107; x=1761058907; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SrYu44JadHRt7GuwzjcxjZ0wn2Xq6CWmDu0PRz9ln7A=; b=C3+K+S9L+Lg6CSKBQNXR+LUJmN8CEz0m0E3sPTL1BN6ssPniDPotNzWy4czvb5DXfW Lnq4lj6VznhN7eX5tohwqfkWNR8ZatFmIaYpf9EvV34IuluTMn+pURw6sXsY/L6A3OK1 P8EG7Vz1PKe1cWtVFW/ipt9n6Y4c+fjxPMP1xf2nfARoELTLv3agnLWANPEcfnb4WRm9 +HzFmX1ljzJt2uepSZQNuLdkxJICAkPio0izNPN8zhY4pXxDm6QA2pcxE/+YnOaSK55r qJK5BG+NY+R5n1xp0m0gt/+mYVazB4JT3+9p5eYohSFdAjDxmpPTJDtz69VpyXs64XWx J5Zw== X-Gm-Message-State: AOJu0Yz3GbupT3sMebtDgQwVv1SEdnbmMefOOkRkLpr8mSPg60DV9EAV 0KlXaOk3+ufJt5ddMgZQ60x4WHdnXet8G1ECSqYb8ZfqnggJfGg0xxPmuTG/ww== X-Gm-Gg: ASbGncv6I6Na6/I6p7XfXt3zOHqwTgDiIijcluvBQt2/bOHZM0tPz/CTz1IGQ7YZIgr sWgSJy3+3BPxMxzYldJKTSEfazMOUvD62KJdUAXbBiZf2k9eRsVwYzfb+8zqoXf70K/4tnGn6gv iV4iPpJq8oeDAbphoBi/wfYrNyc6atm/cSwwVnsPOSDLM9wHBeaojk4dMIRF4m61iSv3O4dXh38 4KAHqTtNIlVAAz0TIgM66UGlS822KGmRpszFtSDmXmlO1kDUZT/83eX4juCdKK9RATrPAqM3dM/ ifciW2hvJzcIPUy3Ri9bsuPlpSfR8gsFtUO0YIYhRr7FzJN4DaXZSFXqOPfbGIGi2h3WvhMDmi2 ddkyTi4+xjnK/jcyZNLBVOeFO X-Google-Smtp-Source: AGHT+IFiGfALc5TbjMFF0GxVv5cid486Iy+fX6Whxe9g52wanymbsg6UPF2zoFuZx8vQe5OyZvo7cw== X-Received: by 2002:a05:600c:a43:b0:46f:b32e:5094 with SMTP id 5b1f17b1804b1-46fb32e50fcmr168461215e9.32.1760454106746; Tue, 14 Oct 2025 08:01:46 -0700 (PDT) Received: from 127.com ([2620:10d:c092:600::1:75fd]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-46fb4983053sm243910975e9.8.2025.10.14.08.01.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Oct 2025 08:01:45 -0700 (PDT) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: asml.silence@gmail.com Subject: [PATCH liburing v4 3/3] test/query: signal query loop Date: Tue, 14 Oct 2025 16:02:57 +0100 Message-ID: X-Mailer: git-send-email 2.49.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [147.75.80.249 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [asml.silence[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: -18 Instead of relying on the kernel limiting the number of queries in a chain, send a signal. That must be able to abort the syscall. Signed-off-by: Pavel Begunkov --- test/ring-query.c | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/test/ring-query.c b/test/ring-query.c index e266b4a9..4c335d64 100644 --- a/test/ring-query.c +++ b/test/ring-query.c @@ -5,11 +5,14 @@ #include #include #include +#include #include "liburing.h" #include "test.h" #include "helpers.h" +pthread_barrier_t barrier; + struct io_uring_query_opcode_short { __u32 nr_request_opcodes; __u32 nr_register_opcodes; @@ -153,9 +156,8 @@ static int test_chain(void) return T_EXIT_PASS; } -static int test_chain_loop(void) +static void *chain_loop_thread(void *arg) { - int ret; struct io_uring_query_opcode op1 = {}, op2 = {}; struct io_uring_query_hdr hdr2 = { .query_op = IO_URING_QUERY_OPCODES, @@ -167,27 +169,36 @@ static int test_chain_loop(void) .query_data = uring_ptr_to_u64(&op1), .size = sizeof(struct io_uring_query_opcode), }; - struct io_uring_query_hdr hdr_self_circular = { - .query_op = IO_URING_QUERY_OPCODES, - .query_data = uring_ptr_to_u64(&op1), - .size = sizeof(struct io_uring_query_opcode), - .next_entry = uring_ptr_to_u64(&hdr_self_circular), - }; hdr1.next_entry = uring_ptr_to_u64(&hdr2); hdr2.next_entry = uring_ptr_to_u64(&hdr1); - ret = io_uring_query(NULL, &hdr1); - if (!ret) { - fprintf(stderr, "chain loop failed %i\n", ret); + + pthread_barrier_wait(&barrier); + + (void)io_uring_query(NULL, &hdr1); + return NULL; +} + +static int test_chain_loop(void) +{ + pthread_t thread; + int ret; + + ret = pthread_barrier_init(&barrier, NULL, 2); + if (ret != 0) { + fprintf(stderr, "pthread_barrier_init failed %i\n", ret); return T_EXIT_FAIL; } - - ret = io_uring_query(NULL, &hdr_self_circular); - if (!ret) { - fprintf(stderr, "chain loop failed %i\n", ret); + if (pthread_create(&thread, NULL, chain_loop_thread, NULL) != 0) { + fprintf(stderr, "pthread_create failed %i\n", ret); return T_EXIT_FAIL; } + pthread_barrier_wait(&barrier); + sleep(1); + pthread_kill(thread, SIGKILL); + pthread_join(thread, NULL); + pthread_barrier_destroy(&barrier); return T_EXIT_PASS; } -- 2.49.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id 6GcqEoJm7mi8CiMAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 15:04:34 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 15:04:34 +0000 Received: from dfw.mirrors.kernel.org ([142.0.200.124]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8gZm-0000000BC5q-032g for hi@josie.lol; Tue, 14 Oct 2025 15:04:34 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.mirrors.kernel.org (Postfix) with ESMTPS id 119F9500E44 for ; Tue, 14 Oct 2025 15:02:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A44702FF170; Tue, 14 Oct 2025 15:01:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jR7lmeeg" X-Original-To: io-uring@vger.kernel.org Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D22FA2FE07E for ; Tue, 14 Oct 2025 15:01:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760454109; cv=none; b=TO8bOFImJa5eHgx1YnRSXR+wSC7c19rC9OYL2AO5S3W+w6ThsfX+1n62mBu4m0CO/Fz0FznVep+TZyNwZXmLRLAfAnLas/4JPsHKfOjU/QuEnw6obdarbBrg3cHMLQymMjqi0HpGGKX4XZrpQnJSNOrX9Kj82WL6MYu/Y/HT8Go= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760454109; c=relaxed/simple; bh=YtcQTTC0REa/jh6CNYL0CMMXriWM+2IwF5Ic9tyMd+Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ow/zG4cvZZ7SK+KCAxJbz/mGu+SCRSaMABTQjxuXZ1cQnEky+YqkZnUogae/wabMg9ox899tAJWnEVUambQlE7rlZTeUwMfVxYd07KtcWF+dbSCX/WZl5YbFmAQPPmEQTizz0m68VAbX3SKFuNmOBwTR2JN5vT2z6549yU8fsq8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jR7lmeeg; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-46e6c8bc46eso36461025e9.3 for ; Tue, 14 Oct 2025 08:01:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760454105; x=1761058905; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9RqR9qSnrD73VuwUQUQmULg2N+WeCXlrB3p8dDCgN2o=; b=jR7lmeegB4ywxyiM0v9x1onOTuiJ55tMt7MIEVDCdEZatTWqcvE3qwOMhU/5ppylSp ztj644ASXSouwabJNtBB7dIvC+iEFvrVL+gmM/tNhjiujo84H/eJVJAtkZ173ZbrsPLk 6GcdQYIuX+h8gfDFnXOPdfnEtOROYQsgXx0B8WngEA6CAzMTcJ0/9T3kOCQHKwHjzaBU kGE3iyLkcbLYZf3Uybfl7Kzhr3U/EtHSFwA63vAS+aUweLX24TkFp3+6cQuJbh9ybGyZ hyqQXeiAnA5I9PFm750Awdtdni+ucaVA78LkZOUgSGvdapDHP5ZMoRrSydwYggQ+boWA 856Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760454105; x=1761058905; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9RqR9qSnrD73VuwUQUQmULg2N+WeCXlrB3p8dDCgN2o=; b=Yf254R0iJL+jucW8sQ23MdcieL5rsQ0DUQg6oDsvDHhU+Xi/f3QjTTWLwB512yX+Di WBbo1Ji7XQCJqAD6o5SAcv//cezjswziMNfmq7mYUymcj1FloK3ai9lP6sGaU06+DdOc x/niia7lDOpZa+XIK9TI9cCbHOaEg7bEec9pdR3EPNI+1+9ic4qrB13iQEabBvgM/P+/ wUckEJ8k3dO3hk8wy7Jev9hSDTVFzIb99moSafyn2OkM5IITHsKcdP9FNNzxWhD15Ns4 R4N8E5RPX+rwvr1p25CKx74+GoFIA1dGF9jb9o83iqkwr1cBWZcex+64NgN8rTyjhgWU Mg5Q== X-Gm-Message-State: AOJu0YxR93hNvcKiJG1dFZ/veCkcbINhXGc2QEC0/NWG33jkkJdw2iRt Ua8fkCOOWvF744Rru+YX9R94ee0DRfpKk81VauLjDyk4u9Berfwbupa6t5dbEw== X-Gm-Gg: ASbGnct70Cnwu0VqO/I3WQrUfP7BSpPtI/8NNX7DZsluAsYTHMsORFzMSAFMt05yayU NAXdOF6x9j8DAp6GpxwBp64yUTwVI+36WHT6uoQNATkh6WkA84MoePDRXZePT5W4ONwYwIX+egi dwczRYotRF0vEp4cyD1FamSwhSBB+OPhAp3fdYLgX1sGe93mBrxfA1DfxtTFqJ/LWfVop9JHEfS 0XeF3CnmBBibR5GBhG/UEFpd07nDSXBwUmxoaJpqWMNs6LzQ8Li36s2zRSqXIJtpul8Da/vKtpm R4v108mSUv22tHPknQJTddVis1EVUFP07OUR1gVDm3Lk2KcupJkemgJaoJFZXot9WY6eRAE1+dP 92+zEu/cVBGgep5RKdnY/3/M1 X-Google-Smtp-Source: AGHT+IH6OECmuSw30yCaLvEFnYwzE9Q8HqqS6goikN0gPwEVNB2dUJ+qBzhsFfmsY6metwcuKSwbQg== X-Received: by 2002:a05:600c:1e85:b0:46e:39e4:1721 with SMTP id 5b1f17b1804b1-46fa9aa261amr169617365e9.12.1760454105251; Tue, 14 Oct 2025 08:01:45 -0700 (PDT) Received: from 127.com ([2620:10d:c092:600::1:75fd]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-46fb4983053sm243910975e9.8.2025.10.14.08.01.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Oct 2025 08:01:44 -0700 (PDT) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: asml.silence@gmail.com Subject: [PATCH liburing v4 2/3] register: expose a query helper Date: Tue, 14 Oct 2025 16:02:56 +0100 Message-ID: <00b81f907a11d467bb51995f0b59fdb1bd85c1d4.1760453798.git.asml.silence@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [asml.silence[at]gmail.com] 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: liburing.map] 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [142.0.200.124 listed in list.dnswl.org] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 Expose a simple wrapper around IORING_REGISTER_QUERY to users. Signed-off-by: Pavel Begunkov --- src/include/liburing.h | 2 ++ src/liburing-ffi.map | 3 ++- src/liburing.map | 3 ++- src/register.c | 7 +++++++ test/ring-query.c | 7 ------- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/include/liburing.h b/src/include/liburing.h index 3d4c6422..7eab7e42 100644 --- a/src/include/liburing.h +++ b/src/include/liburing.h @@ -359,6 +359,8 @@ int io_uring_register_clock(struct io_uring *ring, int io_uring_get_events(struct io_uring *ring) LIBURING_NOEXCEPT; int io_uring_submit_and_get_events(struct io_uring *ring) LIBURING_NOEXCEPT; +int io_uring_query(struct io_uring *ring, struct io_uring_query_hdr *arg); + /* * io_uring syscalls. */ diff --git a/src/liburing-ffi.map b/src/liburing-ffi.map index 4bf4fd51..6eed3f9f 100644 --- a/src/liburing-ffi.map +++ b/src/liburing-ffi.map @@ -253,5 +253,6 @@ LIBURING_2.12 { } LIBURING_2.11; LIBURING_2.13 { - + global: + io_uring_query; } LIBURING_2.12; diff --git a/src/liburing.map b/src/liburing.map index 0c4888e1..92c2af7b 100644 --- a/src/liburing.map +++ b/src/liburing.map @@ -132,5 +132,6 @@ LIBURING_2.12 { } LIBURING_2.11; LIBURING_2.13 { - + global: + io_uring_query; } LIBURING_2.12; diff --git a/src/register.c b/src/register.c index 93eda3fc..7265dcca 100644 --- a/src/register.c +++ b/src/register.c @@ -513,3 +513,10 @@ int io_uring_set_iowait(struct io_uring *ring, bool enable_iowait) ring->int_flags |= INT_FLAG_NO_IOWAIT; return 0; } + +int io_uring_query(struct io_uring *ring, struct io_uring_query_hdr *arg) +{ + int fd = ring ? ring->ring_fd : -1; + + return io_uring_register(fd, IORING_REGISTER_QUERY, arg, 0); +} diff --git a/test/ring-query.c b/test/ring-query.c index d0aa396c..e266b4a9 100644 --- a/test/ring-query.c +++ b/test/ring-query.c @@ -27,13 +27,6 @@ struct io_uring_query_opcode_large { static struct io_uring_query_opcode sys_ops; -static int io_uring_query(struct io_uring *ring, struct io_uring_query_hdr *arg) -{ - int fd = ring ? ring->ring_fd : -1; - - return io_uring_register(fd, IORING_REGISTER_QUERY, arg, 0); -} - static int test_basic_query(void) { struct io_uring_query_opcode op = {}; -- 2.49.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id oMknHhZm7mgsUiYAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 15:02:46 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 15:02:46 +0000 Received: from ams.mirrors.kernel.org ([213.196.21.55]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8gY2-0000000B7ut-0MX7 for hi@josie.lol; Tue, 14 Oct 2025 15:02:46 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.mirrors.kernel.org (Postfix) with ESMTPS id DA402356244 for ; Tue, 14 Oct 2025 15:02:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D29532FF65A; Tue, 14 Oct 2025 15:01:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="O9zwgLVh" X-Original-To: io-uring@vger.kernel.org Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C2FA278772 for ; Tue, 14 Oct 2025 15:01:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760454108; cv=none; b=HwgNdlgYe9535NnJOMFNewY4TP8yY3X9Z/Cudu97EvVEiLxKB41zbKSZmSR9Dd0mTKkr0iRYYGgV1VOZllNNrUnQ9WZTUoPlgNHXsl59Zcl1tNgez+XJLWwQ6tQX17vDF/G48uvVHHrYIxvtcdYNASluvH+fOmjOoYbMgbQXk3w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760454108; c=relaxed/simple; bh=MRLTq0r/inojRzW5SubfXO0IQDhOzsPVb990014y4jg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XK3N/IaFBakHMRujRrkDZY6HIE3AKG2qr4HJPvdnZPXE1+4eB6j4YheDfB80041r52JElhAf8LX+65/+JzP5zTiKisIYLauIPUczGdI973SG+Yoay6h1VLQTSSPfqug1NXAuixUbVjLaKZlFW6JUxiVkLsN4J5L/LLwOUpnkWv0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=O9zwgLVh; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-46e37d10ed2so50503045e9.2 for ; Tue, 14 Oct 2025 08:01:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760454105; x=1761058905; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pH1rlx7kiTnmA2VN4bzdUFPPSmetxk8EkQLpm8UDuEI=; b=O9zwgLVhyLPUIy+vlfNdsfJMWgh7BphZzIj1y8UKXsfPb6MvnMmhxKETvvpmvFrWcD xKGEJZfmbKHHdV8UKbM54C8EdZrjI7Si+GKtaU7iEt6fIU1c2aJ5rpUQNMVzOqSv/IH4 LcwdBum4gu6TsTaJ8hoU2zY4BNqv/BWZPPDGgO29RNsRsJ2Ezgzu4pWWaoULatvyXJOb YpbdFAnyxD3dSkKMZxVVpqGbaVJkXGJx9d+xeu1aFiJCHn3Iml9/wN8UpMQe1U8b6XWw iH6hyocsuWkN3fSDyrkaRoc4gt1JUyz2bbNGbctUxjV4wMRV67fohBziXW+dw1CXkuW1 q5Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760454105; x=1761058905; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pH1rlx7kiTnmA2VN4bzdUFPPSmetxk8EkQLpm8UDuEI=; b=LorkVfqK8BgZkZVI6LseLZqjJkfdUKGU+UX4DYlFplLud1RBUhcYRBU8oWJlBYIKm2 G51r3YgE8rqTTn5AB4/NlMLpu38HVBD3RkQCjcwzJ3YTGJbcFvfjSpsRQZ3wnqVVjz00 BH0KrxLUsS/LpQzQZwHKBszXYeySm7l08zpN3n0ATY24p95wPtkg3Vh5lkXCh4tTobEg Omwc0kSH6BRYNmTwAlQWyj2cy7VS9aNUiTOoUd1b0v8ihd0fGkRIRI4PX0albK5pJWdb vuyR4lSxn48mBnAKKoLuGPIm+PU4NyN/jgVZFPJ+lJ1D2rU9CTbUir78hyYJb8GCq4tu ndcg== X-Gm-Message-State: AOJu0YzfHY/wCDAUhtdyoDlvji0+1KvyodW5gM2k2Q5PCoNGcO0EXE8U SPv5VZUzMY4QM/wPE45C+dPRPmB1I26mcYyQm8xvoz3mVYgeB8gPWUMpwEuJEQ== X-Gm-Gg: ASbGncusIzNkF/kYS0XT6Pqrf+mvOWUYnWr9IgdO8Fd/iMY5c/YjhDa1YVSibXqMWL8 vIJ2CBHU2SK5zt9+KKm/Ev3W/A9SU0v5ZM98OyOFswI40aqUe+Wkbe5bSilzc3SGBMM8VJpiTe3 FknkQ37s1+gwgpzCq8UiiLHVsXsTGkFeWMc7n4PKZaOXqaTm7bavah/17OsDwZIIKR5mIv4qpgB jUMZOyFPxE/0QA65BZRrWpb/a5klNoxdeL1npVWbnujjNwxJTTQPbpeSL4wDRzipp0ac//9GXXU P9SI6vRivmMYbfOfKRT40czMZdcAYahYl57OwT3XLlTg4fYtmQy+k3rqnCI6ds07PLLvYTh5khQ v4dvJhvhF0Aktaq3i5s7gRnIAcT0kwcr+aD8+DjdJPGcASw== X-Google-Smtp-Source: AGHT+IEBLIIA2AWLi9tNv9wjZchxVpHsxfIa78VuW4dgan1dLi7vU5uXga7+qY/6AwlzB/iuIwrXbg== X-Received: by 2002:a05:600c:46c9:b0:46d:27b7:e7ff with SMTP id 5b1f17b1804b1-46fa9b18289mr171219125e9.36.1760454104212; Tue, 14 Oct 2025 08:01:44 -0700 (PDT) Received: from 127.com ([2620:10d:c092:600::1:75fd]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-46fb4983053sm243910975e9.8.2025.10.14.08.01.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Oct 2025 08:01:43 -0700 (PDT) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: asml.silence@gmail.com Subject: [PATCH liburing v4 1/3] tests/query: get rid of uninit struct warnings Date: Tue, 14 Oct 2025 16:02:55 +0100 Message-ID: <6c6df3a32c68feb478787fee1511e67909982cef.1760453798.git.asml.silence@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (0.4 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [213.196.21.55 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [asml.silence[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: 4 Compiling with -O0 revealed that compilers are too smart and complain about io_uring_query_opcode not being initialised. It's not an issue as it's passed to the kernel to be filled in, nevertheless, let's silence the warnings. Signed-off-by: Pavel Begunkov --- test/ring-query.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/ring-query.c b/test/ring-query.c index 971fd9ba..d0aa396c 100644 --- a/test/ring-query.c +++ b/test/ring-query.c @@ -36,7 +36,7 @@ static int io_uring_query(struct io_uring *ring, struct io_uring_query_hdr *arg) static int test_basic_query(void) { - struct io_uring_query_opcode op; + struct io_uring_query_opcode op = {}; struct io_uring_query_hdr hdr = { .query_op = IO_URING_QUERY_OPCODES, .query_data = uring_ptr_to_u64(&op), @@ -76,7 +76,7 @@ static int test_basic_query(void) static int test_invalid(void) { int ret; - struct io_uring_query_opcode op; + struct io_uring_query_opcode op = {}; struct io_uring_query_hdr invalid_hdr = { .query_op = -1U, .query_data = uring_ptr_to_u64(&op), @@ -119,7 +119,7 @@ static int test_invalid(void) static int test_chain(void) { int ret; - struct io_uring_query_opcode op1, op2, op3; + struct io_uring_query_opcode op1 = {}, op2 = {}, op3 = {}; struct io_uring_query_hdr hdr3 = { .query_op = IO_URING_QUERY_OPCODES, .query_data = uring_ptr_to_u64(&op3), @@ -163,7 +163,7 @@ static int test_chain(void) static int test_chain_loop(void) { int ret; - struct io_uring_query_opcode op1, op2; + struct io_uring_query_opcode op1 = {}, op2 = {}; struct io_uring_query_hdr hdr2 = { .query_op = IO_URING_QUERY_OPCODES, .query_data = uring_ptr_to_u64(&op2), @@ -201,7 +201,7 @@ static int test_chain_loop(void) static int test_compatibile_shorter(void) { int ret; - struct io_uring_query_opcode_short op; + struct io_uring_query_opcode_short op = {}; struct io_uring_query_hdr hdr = { .query_op = IO_URING_QUERY_OPCODES, .query_data = uring_ptr_to_u64(&op), @@ -234,7 +234,7 @@ static int test_compatibile_shorter(void) static int test_compatibile_larger(void) { int ret; - struct io_uring_query_opcode_large op; + struct io_uring_query_opcode_large op = {}; struct io_uring_query_hdr hdr = { .query_op = IO_URING_QUERY_OPCODES, .query_data = uring_ptr_to_u64(&op), -- 2.49.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: hi@josie.lol Received: from witcher.mxrouting.net by witcher.mxrouting.net with LMTP id gHbHACFm7mjBCiMAYBR5ng (envelope-from ) for ; Tue, 14 Oct 2025 15:02:57 +0000 Return-path: Envelope-to: hi@josie.lol Delivery-date: Tue, 14 Oct 2025 15:02:57 +0000 Received: from am.mirrors.kernel.org ([147.75.80.249]) by witcher.mxrouting.net with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98) (envelope-from ) id 1v8gYC-0000000B8FW-2KMW for hi@josie.lol; Tue, 14 Oct 2025 15:02:56 +0000 Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3628418A2363 for ; Tue, 14 Oct 2025 15:03:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D28E42FF652; Tue, 14 Oct 2025 15:01:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DP+D2uBg" X-Original-To: io-uring@vger.kernel.org Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE3A42FF170 for ; Tue, 14 Oct 2025 15:01:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760454108; cv=none; b=qIfIlWoDcwF1VkmTegQjhQLk+coto1JKK6XyIZ77QfHH7NHpjcNadZqffZjzsKYmRs7VX1F9foX2S5Tf80UKH9oqQueP5x9xvpgGJ/j+qI58vDm6QHFucmyi0SHNiQDaD0q/M92PcsqE4lvB1bc8iWEK7NvL7qheXe3Lo2RDcKo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760454108; c=relaxed/simple; bh=UwBBgNMEWe7Fq9mr1x7DhnuEFf96EMYoD9DMmVzLnUQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=dp3F7Vu76dfIQZOZIQ0XNlmEoi3Lt4eVtRimvxX2taS+BItVfPoxK+wSNExVUQrbopNCy/WLT07PWOliyipB8qCdQHZl4POw18tNyOjjmYIC+27dgECoInQQ7/xxOMLMHG/Hr7xnqpuQi2b19uvt2/XkG5osdwHtaGbpJgJzgKM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DP+D2uBg; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-46e504975dbso32731835e9.1 for ; Tue, 14 Oct 2025 08:01:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760454103; x=1761058903; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+n5m7vYgc1qGdrQz7ViMfaycJU9zReqvM3Al6om7lsI=; b=DP+D2uBgPaMQGCJ9yXx8zDY5wqJlfCe6tExrlO2vEJxlLbkl3RGfkIsJf3Bka+9Cjs bnZGE7QX/gESu6ANudEEXFTsQlmzOY+pl+F6q2PpQOj88qRcBBDd+P0cG+Xak71cx5+E r0CIT+TCRFNRmEx8znkiaNk/EU+M+Fu/p1Yltam1S+X94+w6FxozvTpMoUkZLK/sMfYp yDOHxIbKxzaExoWuEhaOqb+WUwFkdYSdbcUdt2mwFLOaXJQpfzg67eZcu+BlhUiBTcAX lOlxlyBI2lMCxZ+HnuzlTAAWx2D9hEIu0Emc13Jl88RC3MDvaFHAxYx9xChjR7e3aJDb J3Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760454103; x=1761058903; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+n5m7vYgc1qGdrQz7ViMfaycJU9zReqvM3Al6om7lsI=; b=OZNg0eVfG4TSlCBD7Gv2cib4jZD+YEdUThA8pruV0tmiz1VyrUHbx1tTOAk3r1JOpt TEqmSgF3JfzP2s4Dv7TuwT0HGdCA0hP1kGzldYqegtEmjGLDvst7auJq230gK5tqIoNf m/E/F7fssEsJGcl7ybZ7AKAHrNxzcW3zL7gInMsiPsl4TT/8gO/6625MTNfpKTAem9jt Oq6rPd9kl2mbeWFjB0Omu9E5WBZwnBgGJlgKUYM26o8tom0TiA1AMCTixkK46GgW9YRL NnIJGOYQuBpYg3fQaA7mF3eY4STKjaaQyzu25Lp3T7VjueddeU76ZmJCPvyXbuPZUAfS VeBg== X-Gm-Message-State: AOJu0YxcVWqDKwF0jxV+DZUwPBOIfPyBYettSjpH/vZy9TP0n6m9ZugT zkMGaAI3MUZkHZ9l9WiT/N2HMJqdnu3h96ZW25B1EpJG46ugLgQT3uyS+yzQ+A== X-Gm-Gg: ASbGnctBHEAQ9WWTf06It62zN21Tw/DYlw3uvpvmk9R/HWLxqfCuiGNl8lye4wwYDHv 5rzHxApyvkip468kEaXHJ7F9pfARtnAt+SVXOjidMIl+M3W6n/Gu6ty14FP4s7EX7/xOuaj2q4I RF6fMr42FIoUp7jRqD+OMLlwoAdrhBXkp5w8RDpdedJSYHMMTVZpyT3F3NlftoGE13aL1jpLTw2 mPA3rpDT1fxOb9DuitnRIFU9bagHhm8jV8hrl/yZtf5YIoPyOQrNMUjnu0hDFQo9f+j9nAYhnS5 DNv+SzJx3eM6MAIWMPViy8EcX/OHqKFbGRCW7tCf25Pmg5UebPA4HUW9hbDFthH19mLh712Ke1W QF1keD2bntlGeYuRfqFO32qLo48OO6ACy1tk= X-Google-Smtp-Source: AGHT+IFqSAdjvrO7VCeBp3CJ9i0SZbgVFx8wvCBjK+ywVphRUfFkZX5MyN3OsNrQLp5W/o4Wdy0s6w== X-Received: by 2002:a05:600c:1d11:b0:46e:5aca:3d26 with SMTP id 5b1f17b1804b1-46fa9aef840mr184791875e9.22.1760454103133; Tue, 14 Oct 2025 08:01:43 -0700 (PDT) Received: from 127.com ([2620:10d:c092:600::1:75fd]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-46fb4983053sm243910975e9.8.2025.10.14.08.01.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Oct 2025 08:01:42 -0700 (PDT) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: asml.silence@gmail.com Subject: [PATCH liburing v4 0/3] some query related updates Date: Tue, 14 Oct 2025 16:02:54 +0100 Message-ID: X-Mailer: git-send-email 2.49.0 Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DKIM: signer='gmail.com' status='pass' reason='' DKIMCheck: Server passes DKIM test, 0 Spam score X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "witcher.mxrouting.net", has performed the tests listed below against this email. Information: https://mxroutedocs.com/directadmin/spamfilters/ --- Content analysis details: (-1.9 points) --- pts rule name description ---- ---------------------- ----------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: liburing-ffi.map] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [147.75.80.249 listed in list.dnswl.org] 1.5 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [asml.silence[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager SpamTally: Final spam score: -18 Improve query testing and export a helper to users. There are no man pages yet. Pavel Begunkov (3): tests/query: get rid of uninit struct warnings register: expose a query helper test/query: signal query loop src/include/liburing.h | 2 ++ src/liburing-ffi.map | 3 ++- src/liburing.map | 3 ++- src/register.c | 7 +++++ test/ring-query.c | 60 ++++++++++++++++++++++-------------------- 5 files changed, 45 insertions(+), 30 deletions(-) -- 2.49.0 From - Sun Jan 25 12:34:26 2026 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000