lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <BANLkTimG_oBX1bDTEVfZ81_uqXOahqR1ww@mail.gmail.com>
Date:	Thu, 16 Jun 2011 14:03:36 +0100
From:	Will Newton <will.newton@...il.com>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	Ingo Molnar <mingo@...e.hu>, fweisbec@...il.com,
	Linux Kernel list <linux-kernel@...r.kernel.org>
Subject: [PATCH] ring_buffer: Ensure that buffer page data is aligned.

Explicitly align the start of the buffer page data array to the
required arch alignment. This is required for architectures that
require 8 byte alignment but do not have a 8 byte local_t.

Signed-off-by: Will Newton <will.newton@...tec.com>
---
 kernel/trace/ring_buffer.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

I don't believe that any currently in-tree architecture is affected by
this, but it can be an issue on 32bit architectures that require an
8 byte aligment but only have a 32bit local_t. I think it's potentially
cleaner to make the alignment explicit anyway.

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 0ef7b4b..36d5699 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -215,6 +215,8 @@ EXPORT_SYMBOL_GPL(tracing_is_on);
 # define RB_ARCH_ALIGNMENT		8U
 #endif

+#define RB_ALIGN_DATA		__aligned(RB_ARCH_ALIGNMENT)
+
 /* define RINGBUF_TYPE_DATA for 'case RINGBUF_TYPE_DATA:' */
 #define RINGBUF_TYPE_DATA 0 ... RINGBUF_TYPE_DATA_TYPE_LEN_MAX

@@ -363,7 +365,7 @@ EXPORT_SYMBOL_GPL(ring_buffer_event_data);
 struct buffer_data_page {
 	u64		 time_stamp;	/* page time stamp */
 	local_t		 commit;	/* write committed index */
-	unsigned char	 data[];	/* data of buffer page */
+	unsigned char	 data[] RB_ALIGN_DATA;	/* data of buffer page */
 };

 /*
-- 
1.7.3.4

View attachment "0001-ring_buffer-Ensure-that-buffer-page-data-is-aligned.patch" of type "text/x-patch" (1323 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ