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]
Message-ID: <20071129170436.GA2754@fattire.cabal.ca>
Date:	Thu, 29 Nov 2007 12:04:36 -0500
From:	Kyle McMartin <kyle@...artin.ca>
To:	Daniel Drake <dsd@...too.org>
Cc:	linux-kernel@...r.kernel.org, avuton@...il.com, hancockr@...w.ca,
	alan@...rguk.ukuu.org.uk, andi@...stfloor.org, mrmacman_g4@....com,
	dean@...tic.org, argggh@...phinics.no, jengelh@...putergmbh.de,
	shdl@...alwe.fi, vlobanov@...akeasy.net, drzeus-list@...eus.cx,
	strange@....no-ip.org, dm.n9107@...il.com,
	johannes@...solutions.net
Subject: Re: [RFC v2] Documentation about unaligned memory access

Hi Daniel,

On Thu, Nov 29, 2007 at 04:15:23PM +0000, Daniel Drake wrote:
> Unaligned memory accesses occur when you try to read N bytes of data starting
> from an address that is not evenly divisible by N (i.e. addr % N != 0).
> For example, reading 4 bytes of data from address 0x10004 is fine, but
> reading 4 bytes of data from address 0x10005 would be an unaligned memory
> access.
> 

This is rather ambiguous, while most people know what you mean,
clarifying it a bit might be nice. How about something like,

Unaligned memory accesses occur when trying to read more than a byte
(i.e. u16, u32, u64) in a single instruction from an address that is not
evenly divisible by the width of the type (i.e. addr % width != 0).

For example, if you had 4GB of virtual memory, picture it as an
array of bytes,
	u8 memory[4096 * (1024 * 1024)];	/* 4G bytes */
Aligned accesses would be accessing this array in this manner,
	u16 memory[(4096 * (1024 * 1024)) / sizeof(u16)] /* 2G bytes */
	u32 memory[(4096 * (1024 * 1024)) / sizeof(u32)] /* 1G bytes */
	u64 memory[(4096 * (1024 * 1024)) / sizeof(u64)] /* 512M bytes */
And an unaligned access would be accessing on a non-integer multiple
boundary.

Ok, that kind of sucked too. But you get the idea.

> 
> Why unaligned access is bad
> ===========================
> 

The rest of this looks good.

Acked-by: Kyle McMartin <kyle@...isc-linux.org>

cheers,
	Kyle
-
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