From mboxrd@z Thu Jan 1 00:00:00 1970 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 BE5721DF73C; Tue, 29 Apr 2025 17:05: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=1745946337; cv=none; b=j1tBjkbcTfjEbD5ToJ1YzBe56K71Y/6g0Q7cSAnpiEjryACw+GZw+IWpq7XqAazpDwbwja3JfB79YyCdatBpdeZjqhUBXOzci/UY7nwpfR8RW5gQXIJJmrZYChN466YBSahuCcBaSwq8qX0hToB7UZ1WRaw6zpOaJq3w08vLNs0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745946337; c=relaxed/simple; bh=DWN6c7UjaKWCl3bgAjw4xXyaoTvi2NufpGMUuL205JE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KDL7wHxBLxSXTduuls2mV/DWb9GJT0CFaZbK/aNyDQJpM04iaB5WVyne7mRZaWzwQq2cuWXfz5QpzmQz2sc2LuClE+40VeoWlHLxVCwQS5AVNZQ1I8nRBqwLizUHtSlqoJRs8pRUfBatwaFeC+z4r21DUIiOS4tcJ6+noX3aF38= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=indl8k6K; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="indl8k6K" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AFB7C4CEE9; Tue, 29 Apr 2025 17:05:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1745946337; bh=DWN6c7UjaKWCl3bgAjw4xXyaoTvi2NufpGMUuL205JE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=indl8k6KDWr9ReVuHoE06SwN91NJFGRc8ioOkLVxaGpsVBpdRdNYhNlN4FnjtVbhw pnG659kAYn22yVCg+cr5ClQPjkQ7gtwoeRpUKL6eMcR8ueS1EccKlC3+LYGklqpvpn 91jgcnLV44KOpKQxzDM2POFEiTIAsLMoPppUdedo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Vincent Donnefort , Vlastimil Babka , Mike Rapoport , Jann Horn , Linus Torvalds , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 6.14 233/311] tracing: Enforce the persistent ring buffer to be page aligned Date: Tue, 29 Apr 2025 18:41:10 +0200 Message-ID: <20250429161130.572666881@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250429161121.011111832@linuxfoundation.org> References: <20250429161121.011111832@linuxfoundation.org> User-Agent: quilt/0.68 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 6.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Steven Rostedt [ Upstream commit c44a14f216f45d8bf1634b52854a699d7090f1e8 ] Enforce that the address and the size of the memory used by the persistent ring buffer is page aligned. Also update the documentation to reflect this requirement. Link: https://lore.kernel.org/all/CAHk-=whUOfVucfJRt7E0AH+GV41ELmS4wJqxHDnui6Giddfkzw@mail.gmail.com/ Cc: Masami Hiramatsu Cc: Mark Rutland Cc: Mathieu Desnoyers Cc: Andrew Morton Cc: Vincent Donnefort Cc: Vlastimil Babka Cc: Mike Rapoport Cc: Jann Horn Link: https://lore.kernel.org/20250402144953.412882844@goodmis.org Suggested-by: Linus Torvalds Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin --- Documentation/admin-guide/kernel-parameters.txt | 2 ++ Documentation/trace/debugging.rst | 2 ++ kernel/trace/trace.c | 10 ++++++++++ 3 files changed, 14 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index aa7447f8837cb..56be1fc99bdd4 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -7243,6 +7243,8 @@ This is just one of many ways that can clear memory. Make sure your system keeps the content of memory across reboots before relying on this option. + NB: Both the mapped address and size must be page aligned for the architecture. + See also Documentation/trace/debugging.rst diff --git a/Documentation/trace/debugging.rst b/Documentation/trace/debugging.rst index 54fb16239d703..d54bc500af80b 100644 --- a/Documentation/trace/debugging.rst +++ b/Documentation/trace/debugging.rst @@ -136,6 +136,8 @@ kernel, so only the same kernel is guaranteed to work if the mapping is preserved. Switching to a different kernel version may find a different layout and mark the buffer as invalid. +NB: Both the mapped address and size must be page aligned for the architecture. + Using trace_printk() in the boot instance ----------------------------------------- By default, the content of trace_printk() goes into the top level tracing diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 0e6d517e74e0f..50aa6d5908329 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -10427,6 +10427,16 @@ __init static void enable_instances(void) } if (start) { + /* Start and size must be page aligned */ + if (start & ~PAGE_MASK) { + pr_warn("Tracing: mapping start addr %pa is not page aligned\n", &start); + continue; + } + if (size & ~PAGE_MASK) { + pr_warn("Tracing: mapping size %pa is not page aligned\n", &size); + continue; + } + addr = map_pages(start, size); if (addr) { pr_info("Tracing: mapped boot instance %s at physical memory %pa of size 0x%lx\n", -- 2.39.5