From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (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 2E4FF378D8B for ; Thu, 13 Aug 2026 10:02:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.195.75.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786615375; cv=none; b=EN+WKxpC1Y+mTEdGt3vYxVawYFnQWx5XTw2udbZSjHoNDQHCjuRbPbeCE/FBI1MGbJxNwO/OCCIn0OPnL6adRnIT+cKLltry0+1kf8gHvXvANniZHLKMxSwaVrQ7Dhk9Ov2Y4Z5cGteu9bmP9y/JSR2L+d5n++SD+21niWvzZ0M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786615375; c=relaxed/simple; bh=tanX7f1b9c0MmsWbxVq9RS0LlQm73iyrFiiu0xCz+SY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KjMnskaDOE+v0Dh4pKgLjadI6WWjyeyhQ1mnqf/cqfJw7E3f/6ubZlmRSJ0+vRLOzTSRrlrhDZs2bikO5lWmKBoFmqwXvMASRhcjjkmq35GKtHUKxki2pXMjLM+TQ9P+dOAWkda8UGm+JPCi1l0zD0sQsXcQ8zyvFNnjXUu+kXY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=debian.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b=Uc6B1+54; arc=none smtp.client-ip=82.195.75.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b="Uc6B1+54" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=Y20Ns8/o42YLbUNZyUIkw/RjdW/LS6iDwOmz4RkCo2g=; b=Uc6B1+54cds4o9pQiQUqSOQnJj Iw35vhsYmab52ZbTRJti+wIUS3gZ1DdEtWR3SLfj0cuMAxcDV3yVPOhTwkruzbyXorE9qxHa+Scq7 62828SI3KU0CPQBuaVHqgjawHCqipuW9Brug0193uZ/1R7S7o74F/jkd8A6G8znA9Zv729ZJEKD2W 1Y1KZPppAE+W+g1ENvoI1jheO7/y1zD36+Y9zHZw0Yov5uhv8+SIiKQ3UE+9LPjzwt1qwhVa/M7kk pVCpXJX+enUYXgM2KdsFUdCrMFi4jIFEgRdx4NBvcG6Z4gENn2/bss4cjAaL2IdPu92P7sEy2jesK O+QmRN+A==; Received: from authenticated-user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1wuSGj-00520V-2U; Thu, 13 Aug 2026 10:02:38 +0000 From: Breno Leitao Date: Thu, 13 Aug 2026 03:02:20 -0700 Subject: [PATCH v2 1/3] mm, swap: ratelimit bad swap entry reports Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260813-swap-v2-1-4a625ccabdae@debian.org> References: <20260813-swap-v2-0-4a625ccabdae@debian.org> In-Reply-To: <20260813-swap-v2-0-4a625ccabdae@debian.org> To: Andrew Morton , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , Barry Song , Youngjun Park , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Jann Horn , Pedro Falcato , Hugh Dickins , Baolin Wang , Peter Xu , Johannes Weiner , Yosry Ahmed , Chengming Zhou Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, Breno Leitao X-Mailer: b4 0.16-dev-f8e9d X-Developer-Signature: v=1; a=openpgp-sha256; l=1410; i=leitao@debian.org; h=from:subject:message-id; bh=tanX7f1b9c0MmsWbxVq9RS0LlQm73iyrFiiu0xCz+SY=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqfZYwUNV/hsWYVXh0g9Yl/bbnTzarJh+bZt0Dv YjK4FGOAhKJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCan2WMAAKCRA1o5Of/Hh3 bbjeD/9wylsh0OoUfAP4Sfl4AOZVYZSdOyuXtSPCArhrnvA7XBNQ029lqt81WKo/905j9kEqNbh gr/9oo7wEt/QZpUHcyvCZ3Lw5DWzTe8DkSBDFYZb6fvnruBSA4IRXfz+0Iow7x6TKSLt5GA/czz LFx8trtpgKTX3AJKQj7KhrOnVjWz/RtcAnbVqMlsgDnBHg/+RkD2gbf/H3VW+J/V07wpmq1v66z zxx8ASEddvix+EBFJUCYByNjTeZxd2ZEWIvGPEgr+82H9gyHtdcyTTyRw36CKpAq/i3fpZvLBBx I1l+7X0NeVeBmGwuH3QYDJjj0XerakXaAtqfdKUo2CbDr6+eXgaDWaSHEsm03QgRS68mwiaSBfR /pmxoDTd7IQHZS1CcTLQky9wdI4lVkAjH7N0LGktdO4q9k4RmiheRc3E61+D32PJuJnfkUbkTbb QhY2HVG3D2G7EI4GQs3EgY1Od765pz/lkET+FOhkoPinOXHB8vVqP0lwdkkw8WmSBPd57QXcRVx Ci0W8W4qC1LNZMnisEZLeNVgBppJSmBrt5FvGIlJZ6J2et67g3iR/hkv436TvLja/b5jLbUl+Pb 0J1w7Cv2jQdi8U2N563YY3hx5B0KHQHUun66XWrHnSyH12PV1mjPWnCCat8lkB5Kt8Lb2BkyPEz KX988srXNdlhE/Q== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao A corrupt page table hands the same bogus entry to get_swap_device() on every access to the mapping, and every rejection is logged. One machine logged 6185620 copies of the same line in a few hours. swap_dup_entry_direct() prints the same message from the fork path, once per call: the WARN_ON_ONCE() guarding it warns once, the pr_err() inside does not. Rate limit all three prints. Signed-off-by: Breno Leitao --- mm/swapfile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 4d4e3e3059f6b..31c8a340606bb 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1899,11 +1899,11 @@ struct swap_info_struct *get_swap_device(swp_entry_t entry) return si; bad_nofile: - pr_err("%s: %s%08lx\n", __func__, Bad_file, entry.val); + pr_err_ratelimited("%s: %s%08lx\n", __func__, Bad_file, entry.val); out: return NULL; put_out: - pr_err("%s: %s%08lx\n", __func__, Bad_offset, entry.val); + pr_err_ratelimited("%s: %s%08lx\n", __func__, Bad_offset, entry.val); percpu_ref_put(&si->users); return NULL; } @@ -3876,7 +3876,7 @@ int swap_dup_entry_direct(swp_entry_t entry) si = swap_entry_to_info(entry); if (WARN_ON_ONCE(!si)) { - pr_err("%s%08lx\n", Bad_file, entry.val); + pr_err_ratelimited("%s%08lx\n", Bad_file, entry.val); return -EINVAL; } -- 2.53.0-Meta