From: Andrey Ryabinin <aryabinin@virtuozzo.com>
To: David Laight <David.Laight@ACULAB.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 14:45:20 +0300 [thread overview]
Message-ID: <2b78febd-ff00-0ed1-33fa-8575541a72dc@virtuozzo.com> (raw)
In-Reply-To: <168669e65cff4bc1b2fbed842cea5dec@AcuMS.aculab.com>
On 12/08/2017 02:14 PM, David Laight wrote:
> 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.
>
Ok, *could* be a bug.
> ...
>> 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 :-)
The gcc developers must have good self-preservation instinct, that's why they usually provide switch off for optimizations like this.
prev parent reply other threads:[~2017-12-08 11:41 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
2017-12-08 11:45 ` Andrey Ryabinin [this message]
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=2b78febd-ff00-0ed1-33fa-8575541a72dc@virtuozzo.com \
--to=aryabinin@virtuozzo.com \
--cc=David.Laight@ACULAB.COM \
--cc=akpm@linux-foundation.org \
--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®