From: Linus Torvalds <torvalds@linux-foundation.org>
To: Arjan van de Ven <arjan@linux.intel.com>
Cc: james.morse@arm.com, salyzyn@android.com,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"vladimir.murzin@arm.com" <vladimir.murzin@arm.com>,
Will Deacon <will.deacon@arm.com>,
Robin Murphy <robin.murphy@arm.com>,
"riandrews@android.com" <riandrews@android.com>,
Peter Anvin <hpa@zytor.com>,
"Dave.Martin@arm.com" <Dave.Martin@arm.com>,
EunTaik Lee <eun.taik.lee@samsung.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"suzuki.poulose@arm.com" <suzuki.poulose@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH v2] arm64: add alignment fault hanling
Date: Tue, 16 Feb 2016 16:28:46 -0800 [thread overview]
Message-ID: <CA+55aFyr56yHSzWA77-+P4hm2nzUgx0cea7Zk8YD0YqJv1W43w@mail.gmail.com> (raw)
In-Reply-To: <CA+55aFz+ttJoEG_WkpkwV=+Wunzxpj9NoHobq-8oFZS0HEEyeA@mail.gmail.com>
On Tue, Feb 16, 2016 at 1:42 PM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> On Feb 16, 2016 1:31 PM, "Arjan van de Ven" <arjan@linux.intel.com> wrote:
>>
>> but what happens to the read if the page isn't present?
>> or is execute-only or .. or ..
>
> If we actually get a fault and handle the exception (not handling the
> exception was the problem on arm), the exception code will just cut off the
> pathname at the page boundary.
>
> So it will see the accessible part, and get zeroes for the inaccessible one.
Actually, looking closer, we only do that for the kernel case (where
pagealloc-debug can cause the unaligned path component in *kernel*
space to trap).
I misremembered because I considered doing it for user accesses too,
but as Catalin correctly says, there we don't actually end up being
that clever, and we just fall back to byte-at-a-time. Which means that
we do get the exact EFAULT behavior even though I'm not 100% convinced
we need to.
See the use of "load_unaligned_zeropad()" (in the dcache handling) vs
just "get_user()" (in strncpy_from_user()).
The fault case doesn't actually ever happen in practice.
The IS_UNALIGNED() case (on architectures with inefficient unaligned
handling), which also falls back to the byte-at-a-time model, is
likely a much bigger problem. They probably need their own strncpy if
they care about performance. But the common architectures all happily
do efficient unaligneds these days.
Linus
next prev parent reply other threads:[~2016-02-17 0:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-16 4:44 [PATCH v2] arm64: add alignment fault hanling EunTaik Lee
2016-02-16 10:31 ` Will Deacon
2016-02-16 10:57 ` Robin Murphy
2016-02-16 12:21 ` Catalin Marinas
2016-02-16 16:00 ` Will Deacon
2016-02-16 17:04 ` Will Deacon
2016-02-16 18:50 ` Linus Torvalds
2016-02-16 21:31 ` Arjan van de Ven
2016-02-16 23:04 ` Catalin Marinas
[not found] ` <CA+55aFz+ttJoEG_WkpkwV=+Wunzxpj9NoHobq-8oFZS0HEEyeA@mail.gmail.com>
2016-02-17 0:28 ` Linus Torvalds [this message]
2016-02-19 18:14 ` Catalin Marinas
2016-02-19 22:09 ` Linus Torvalds
2016-02-16 17:09 ` Catalin Marinas
2016-02-16 17:11 ` Catalin Marinas
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=CA+55aFyr56yHSzWA77-+P4hm2nzUgx0cea7Zk8YD0YqJv1W43w@mail.gmail.com \
--to=torvalds@linux-foundation.org \
--cc=Dave.Martin@arm.com \
--cc=arjan@linux.intel.com \
--cc=catalin.marinas@arm.com \
--cc=eun.taik.lee@samsung.com \
--cc=hpa@zytor.com \
--cc=james.morse@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=riandrews@android.com \
--cc=robin.murphy@arm.com \
--cc=salyzyn@android.com \
--cc=suzuki.poulose@arm.com \
--cc=vladimir.murzin@arm.com \
--cc=will.deacon@arm.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;
as well as URLs for NNTP newsgroup(s).