From: David Laight <David.Laight@ACULAB.COM>
To: "'Andrey Ryabinin'" <aryabinin@virtuozzo.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Ding Tianhong <dingtianhong@huawei.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
LinuxArm <linuxarm@huawei.com>
Subject: RE: [PATCH v2] ubsan: don't handle misaligned address when support unaligned access
Date: Fri, 8 Dec 2017 11:14:34 +0000 [thread overview]
Message-ID: <168669e65cff4bc1b2fbed842cea5dec@AcuMS.aculab.com> (raw)
In-Reply-To: <8c7cc89e-f976-077b-7b64-1046a1f69569@virtuozzo.com>
From: Andrey Ryabinin
> Sent: 08 December 2017 10:49
...
> CONFIG_UBSAN_ALIGNMENT is already disabled by default for HAVE_EFFICIENT_UNALIGNED_ACCESS=y because it's noisy,
> but we still allow users to enable it if they want to.
>
> I don't think we should completely forbid enabling it for HAVE_EFFICIENT_UNALIGNED_ACCESS=y.
> Unaligned access is still a bug in non-arch code and outside of sections like #ifdef HAVE_EFFICIENT_UNALIGNED_ACCESS .. #endif .
Don't think so.
Code that knows that unaligned accesses don't fault can set up pointers
that non-arch code dereferences.
Happens all the time in the networking stack.
...
> And one day, GCC might start doing optimizations based on this, e.g.:
>
> u64 *ptr;
> ...
> x = *ptr;
> ...
> if (ptr & 7) // Compiler can assume that this statement is always false, because 'ptr' was deferenced, so it must be aligned
> do_something();
Ugg - shoot the gcc developers :-)
David
next prev parent reply other threads:[~2017-12-08 11:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-02 5:46 Ding Tianhong
2017-12-07 0:49 ` Andrew Morton
2017-12-07 1:11 ` Ding Tianhong
2017-12-07 13:31 ` Andrey Ryabinin
2017-12-07 23:24 ` Andrew Morton
2017-12-08 10:00 ` David Laight
2017-12-08 10:48 ` Andrey Ryabinin
2017-12-08 11:14 ` David Laight [this message]
2017-12-08 11:45 ` Andrey Ryabinin
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=168669e65cff4bc1b2fbed842cea5dec@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=akpm@linux-foundation.org \
--cc=aryabinin@virtuozzo.com \
--cc=dingtianhong@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
/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
all inboxes | Powered by JetHome®