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:	Thu, 26 Aug 2010 12:48:40 -0700
From:	"H. Peter Anvin" <hpa@...or.com>
To:	Sam Ravnborg <sam@...nborg.org>
CC:	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
	fujita.tomonori@....ntt.co.jp, linux-kernel@...r.kernel.org,
	x86@...nel.org, Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH 01/10] x86/iommu: Add IOMMU_INIT macros, .iommu_table
 section, and iommu_table_entry structure.

On 08/26/2010 11:19 AM, Sam Ravnborg wrote:
> 
> So we have yet another magic section in vmlinux.lds.S
> A nice comemnt that expalins what this is used for and why
> it is discardable etc. would be nice.
> 
> Lots of magic sections in same file miss this,
> but thats not an example to follwow.
> 

Honestly, I think we this kind of problem -- a mergeable table -- often
enough that we should implement a generic facility for it.  It obviously
has to be based on sections, but I think we could automate its creation.
 The gPXE people have done that, and this is more or less a summary of
their technique.

Basically, you have a set of sections with names like:

	.table.<symbol>.<priority>

... then the linker script looks something like:

	.table : {
		SORT_BY_NAME(.table.*)
	}

use SORT_BY_NAME() in the linker script.  To get the start and end
symbols, we define them as solo symbols inside sections designed to sort
first and last (written by hand into email, so adjustments may be
needed, void where prohibited):

#define TABLE(name, priority) \
	__section(".table." ## name ## "." ## priority)

#define DECLARE_TABLE(type, name) \
	extern type __table ## name ## _start[0]; \
	extern type __table ## name ## _end[0];

#define DEFINE_TABLE(type, name) \
	type __table ## name ## _start[0] TABLE(name, 0); \
	type __table ## name ## _end[0] TABLE(name, 9);

Here "priority" is a digit from 1 (first) to 8 (last); 0 and 9 are used
for the capstones.

Presumably we need a few different flavors for init tables and so on,
but this would make it a generic mechanism.

	-hpa
--
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