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-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 21 Jan 2011 16:05:09 -0800 (PST)
From:	David Miller <davem@...emloft.net>
To:	mathieu.desnoyers@...icios.com
Cc:	linux-kernel@...r.kernel.org, rostedt@...dmis.org,
	fweisbec@...il.com, mingo@...e.hu, richm@...elvet.org.uk,
	ben@...adent.org.uk, sparclinux@...r.kernel.org
Subject: Re: [patch 2/3] tracing: fix sparc64 alignment crash with
 __u64_aligned/U64_ALIGN()

From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Date: Fri, 21 Jan 2011 15:36:32 -0500

> Problem description:
> 
> gcc happily align structures defined statically on 32-byte. Ftrace trace events
> and Tracepoints both statically define structures into sections (using the
> "section" attribute), to then assign these to symbols with the linker scripts to
> iterate the these sections as an array.
> 
> However, gcc uses different alignments for these structures when they are
> defined statically and when they are globally visible and/or in an array.
> Therefore iteration on these arrays sees "holes" of padding.
> 
> Use the __u64_aligned for type declarations and variable definitions to ensure
> that gcc:
> 
> a) iterates on the correctly aligned type. (type attribute)
> b) generates the definitions within the sections with the appropriate alignment.
>    (variable attribute)
> 
> The Ftrace code introduced the "aligned(4)" variable attribute in commit
> 1473e4417c79f12d91ef91a469699bfa911f510f to try to work around this problem that
> showed up on x86_64, but it causes unaligned accesses on sparc64, and is
> generally a bad idea on 64-bit if RCU pointers are contained within the
> structure. Moreover, it did not use the same attribute as type attribute, which
> could cause the iteration on the extern array structure not to match the
> variable definitions for some structure sizes.
> 
> We should also ensure proper alignment of each Ftrace section in
> include/asm-generic/vmlinux.lds.h.
> 
> Moving all STRUCT_ALIGN() for FTRACE_EVENTS() and TRACE_SYSCALLS() into the
> definitions, so the alignment is only done if these infrastructures are
> configured in. Use U64_ALIGN instead of STRUCT_ALIGN.
> 
> Also align TRACE_PRINTKS on U64_ALIGN to make sure the beginning of the section
> is aligned on pointer size.
> 
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>

Acked-by: David S. Miller <davem@...emloft.net>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ