From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 934C53876CC; Fri, 4 Sep 2026 05:06:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788498390; cv=none; b=J+Q9fUtw839jw7abAKAK2vjIHuSTwvgLYI2A5yopLKm3OGQPWbNqtVIRuMCTk1tjFL7WUC0vhRvagbH1qver8J7o2ZQ4nCwir3fOtjlttBg3k3RrroBLsf4YE+LNB056msi57dZTwvNkM20kAg5I70E+o8BKFLj5h6KokuhvPnE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788498390; c=relaxed/simple; bh=sA/NqdVn7cZ6n7LX/HEVDmhO3LrlzILicBEF+OV6igU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nMBf9KISTZ2n+BIV/7qCEsvyS8wYAkzpTkVwOckkOUOISr1bjapPLxLoJZs/HeSRfOlPtFxEuau7VYDieOb5RZfbcLwfTagGWhm0mXlzXlxZlbVf4j0BigKQYcqqeoXyYIcGaRPJ7IRXnsQGyy8pwHNwN5ousI/aHIXxSuxDTjw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=N4TXkXRb; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="N4TXkXRb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E71331F00A3D; Fri, 4 Sep 2026 05:06:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788498389; bh=GSV3P1j8UOPdi7LeJRxWGarQmnebaUaicnFoBmZzhMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=N4TXkXRb24bSXRndBYv/OKjQXYWGCjxe++2ni2nKcDJnsTwARsIkQ+euAexUXtSWY qEr2ONDxPGYV+Ri2Asi0Mv1FB6RuQlEPpv6ypUcAA+zH6ZNrY1fuxGstYExh+CEr2D tjuOy5ViSf9oWwShjv5MZFYXrM+g2Hhcy47qG+sE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Breno Leitao , Barry Song , Nhat Pham , Kairui Song , "David Hildenbrand (Arm)" , Baoquan He , Chris Li , Kemeng Shi , Miaohe Lin , Oscar Salvador , Andrew Morton Subject: [PATCH 7.2 046/713] mm, swap: ratelimit bad swap entry reports Date: Fri, 4 Sep 2026 06:50:14 +0200 Message-ID: <20260904045804.861727572@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260904045803.810145556@linuxfoundation.org> References: <20260904045803.810145556@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: Breno Leitao commit f9dc428249ed962a70acf301f01eae8578449161 upstream. 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. Link: https://lore.kernel.org/20260818-swap_part_one-v1-1-a4fc58119fc0@debian.org Fixes: 23b230ba8ac3 ("mm/swap: print bad swap offset entry in get_swap_device") Signed-off-by: Breno Leitao Reviewed-by: Barry Song Reviewed-by: Nhat Pham Acked-by: Kairui Song Acked-by: David Hildenbrand (Arm) Cc: Baoquan He Cc: Chris Li Cc: Kemeng Shi Cc: Miaohe Lin Cc: Oscar Salvador Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/swapfile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1893,11 +1893,11 @@ struct swap_info_struct *get_swap_device 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; } @@ -3871,7 +3871,7 @@ int swap_dup_entry_direct(swp_entry_t en 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; }