Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1335951
| From | Linus Torvalds <torvalds@linux-foundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2] arm64: add alignment fault hanling |
| Date | 2016-02-17 01:30 +0100 |
| Message-ID | <r2Yad-6Sl-1@gated-at.bofh.it> (permalink) |
| References | (4 earlier) <r2Qmn-1Is-29@gated-at.bofh.it> <r2Rip-2mN-1@gated-at.bofh.it> <r2T0S-3ha-3@gated-at.bofh.it> <r2VvI-530-37@gated-at.bofh.it> <r2Yad-6Sl-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2] arm64: add alignment fault hanling EunTaik Lee <eun.taik.lee@samsung.com> - 2016-02-16 05:50 +0100
Re: [PATCH v2] arm64: add alignment fault hanling Will Deacon <will.deacon@arm.com> - 2016-02-16 11:40 +0100
Re: [PATCH v2] arm64: add alignment fault hanling Robin Murphy <robin.murphy@arm.com> - 2016-02-16 12:00 +0100
Re: [PATCH v2] arm64: add alignment fault hanling Catalin Marinas <catalin.marinas@arm.com> - 2016-02-16 13:30 +0100
Re: [PATCH v2] arm64: add alignment fault hanling Will Deacon <will.deacon@arm.com> - 2016-02-16 17:10 +0100
Re: [PATCH v2] arm64: add alignment fault hanling Will Deacon <will.deacon@arm.com> - 2016-02-16 18:10 +0100
Re: [PATCH v2] arm64: add alignment fault hanling Linus Torvalds <torvalds@linux-foundation.org> - 2016-02-16 20:00 +0100
Re: [PATCH v2] arm64: add alignment fault hanling Arjan van de Ven <arjan@linux.intel.com> - 2016-02-16 22:40 +0100
Re: [PATCH v2] arm64: add alignment fault hanling Catalin Marinas <catalin.marinas@arm.com> - 2016-02-17 00:10 +0100
Re: [PATCH v2] arm64: add alignment fault hanling Linus Torvalds <torvalds@linux-foundation.org> - 2016-02-17 01:30 +0100
Re: [PATCH v2] arm64: add alignment fault hanling Catalin Marinas <catalin.marinas@arm.com> - 2016-02-19 19:20 +0100
Re: [PATCH v2] arm64: add alignment fault hanling Linus Torvalds <torvalds@linux-foundation.org> - 2016-02-19 23:10 +0100
Re: [PATCH v2] arm64: add alignment fault hanling Catalin Marinas <catalin.marinas@arm.com> - 2016-02-16 18:20 +0100
Re: [PATCH v2] arm64: add alignment fault hanling Catalin Marinas <catalin.marinas@arm.com> - 2016-02-16 18:20 +0100
csiph-web