mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Ahmad Fatoum <ahmad@a3f.at>
Cc: barebox@lists.infradead.org, afa@pengutronix.de
Subject: Re: [PATCH 5/5] commands: fix unaligned accesses of aliased commands on amd64
Date: Fri, 23 Aug 2019 09:36:56 +0200	[thread overview]
Message-ID: <20190823073656.6l2qzionxlbhxac4@pengutronix.de> (raw)
In-Reply-To: <20190822061941.6093-6-ahmad@a3f.at>

On Thu, Aug 22, 2019 at 08:19:41AM +0200, Ahmad Fatoum wrote:
> If a command has aliases (e.g. edit and sedit), register_command
> allocates a new struct command for the alias. As struct command has a
> alignment of 64 specified on __x86_64__, this new allocation needs to
> observe the alignment lest unaligned access could occur. I don't think
> it's likely that GCC would generate SIMD code here that expects a 64 byte
> alignment, but heed UBSan's advice and use xmemalign with the appropriate
> alignment.
> 
> Fixes: 8c14b97758 ("svn_rev_477")
> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
> ---
> I am not sure about this, because I don't understand why there was a 64
> bit alignment in the x86_64 linker script in the first place.
> The fix is trivial though, so even if it's only a theoretical, lets have
> it?

Have you tried removing the alignment? AFAIK without it we are not able
to iterate over the commands array generated by the linker. I don't know
if this issue is still present. There is no requirement to align a
struct command to 64bit otherwise.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2019-08-23  7:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-22  6:19 [PATCH 0/5] sandbox: support -fsanitize={address,ubsan} Ahmad Fatoum
2019-08-22  6:19 ` [PATCH 1/5] sandbox: include header to provide missing prototype Ahmad Fatoum
2019-08-22  6:19 ` [PATCH 2/5] common: add generic CONFIG_UBSAN_SANITIZE_ALL plumbing Ahmad Fatoum
2019-08-22  6:19 ` [PATCH 3/5] common: add generic CONFIG_KASAN option Ahmad Fatoum
2019-08-22  6:19 ` [PATCH 4/5] sandbox: support Address and UndefinedBehavior sanitizers Ahmad Fatoum
2019-08-22  6:19 ` [PATCH 5/5] commands: fix unaligned accesses of aliased commands on amd64 Ahmad Fatoum
2019-08-23  7:36   ` Sascha Hauer [this message]
2019-08-23  9:08     ` Ahmad Fatoum
2019-08-23  9:13 ` [PATCH 0/5] sandbox: support -fsanitize={address,ubsan} Ahmad Fatoum
2019-08-23 12:31 ` Ahmad Fatoum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190823073656.6l2qzionxlbhxac4@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=afa@pengutronix.de \
    --cc=ahmad@a3f.at \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox